Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Um_Tokens::um_token( $value, $pieces, $recipe_id, $trigger_data, $user_id, $replace_args )
Parse the tokens.
Contents
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830
Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Parameters Parameters
- $value
(Required)
- $pieces
(Required)
- $recipe_id
(Required)
- $trigger_data
(Required)
- $user_id
(Required)
- $replace_args
(Required)
Return Return
(string|null)
Source Source
File: src/integrations/ultimate-member/tokens/um-tokens.php
public function um_token( $value, $pieces, $recipe_id, $trigger_data, $user_id, $replace_args ) { $to_match = [ 'WPROLE', 'UMFORM' ]; if ( $pieces ) { if ( array_intersect( $to_match, $pieces ) ) { $piece = $pieces[1]; $meta = $pieces[2]; if ( $trigger_data ) { foreach ( $trigger_data as $trigger ) { if ( 'WPROLE' === $piece && isset( $trigger['meta'][ $piece ] ) ) { $role = $trigger['meta'][ $piece ]; foreach ( wp_roles()->roles as $role_name => $role_info ) { if ( $role == $role_name ) { $value = $role_info['name']; } } } elseif ( key_exists( $piece, $trigger['meta'] ) ) { $token_info = explode( '|', $meta ); $form_id = $token_info[0]; $meta_key = $token_info[1]; $match = "{$meta_key}-{$form_id}"; if ( isset( $_POST[ $match ] ) ) { $value = sanitize_text_field( $_POST[ $match ] ); } else { if ( isset( $_POST[ $meta_key ] ) && ! is_array( $_POST[ $meta_key ] ) ) { $value = sanitize_text_field( $_POST[ $meta_key ] ); } elseif ( isset( $_POST[ $meta_key ] ) && is_array( $_POST[ $meta_key ] ) ) { $value = sanitize_text_field( join( ', ', $_POST[ $meta_key ] ) ); } elseif ( isset( $_POST["{$meta_key}_select"] ) ) { if ( is_array( $_POST["{$meta_key}_select"] ) ) { $value = sanitize_text_field( join( ', ', $_POST["{$meta_key}_select"] ) ); } else { $value = sanitize_text_field( $_POST["{$meta_key}_select"] ); } } else { $m_k = str_replace( '_select', '', $meta_key ); if ( isset( $_POST[ $m_k ] ) ) { if ( is_array( $_POST[ $m_k ] ) ) { $value = sanitize_text_field( join( ', ', $_POST[ $m_k ] ) ); } else { $value = sanitize_text_field( $_POST[ $m_k ] ); } } } } } } } } } return $value; }
Expand full source code Collapse full source code View on Github