Home › Forums › Plugin Support › Email notification containing custom checkbox fields
Tagged: email
- This topic has 6 replies, 4 voices, and was last updated 12 years ago by
Support.
-
AuthorPosts
-
November 11, 2012 at 1:53 pm #2459November 20, 2012 at 4:16 pm #2476
graspdigital
MemberI am having the exact same problem and still not managed to find a solution.
If anyone has any answers it would be very much appreciated.
ThanksNovember 21, 2012 at 12:26 am #2478Support
MemberHello,
For version 1.1.2-pro and 1.1.3rc1, open /models/pro/umSupportProModel.php and insert following lines of code between line number 355 and 356.
if( is_array( $replacements[ $key ] ) ){
$replacements[ $key ] = implode( ',', $replacements[ $key ] );
}
Thanks.
November 21, 2012 at 10:05 pm #2481graspdigital
MemberHi,
Thanks for this. I’ve tried this and it doesn’t seem to do anything.
It is also a problem for when your exporting to csv too.This is my code now from lines 353 to 362:
elseif( $fieldName == ‘lostpassword_form’ )
$replacements[ $key ] = self::lostPasswordForm();
else
if( is_array( $replacements[ $key ] ) ){
$replacements[ $key ] = implode( ‘,’, $replacements[ $key ] );
}
$replacements[ $key ] = @$user->$fieldName;
}
$data = str_replace($patterns, $replacements, $data);
}November 27, 2012 at 9:22 pm #2517graspdigital
MemberI’ve actually just got this working, for anyone that needs this solution, the function inside umSupportProModel.php starting from line 326 is this:
function convertUserContent( $user, $data, $extra=array() ){
preg_match_all( ‘/\%[a-zA-Z0-9_-]+\%/i’, $data, $matches);
if( is_array( @$matches[0] ) ){
$patterns = $matches[0];
$replacements = array();
foreach( $patterns as $key => $pattern ){
$fieldName = strtolower( trim( $pattern, ‘%’ ) );
if( $fieldName == ‘site_title’ )
$replacements[ $key ] = get_bloginfo( ‘name’ );
elseif( $fieldName == ‘site_url’ )
$replacements[ $key ] = site_url();
elseif( $fieldName == ‘avatar’ )
$replacements[ $key ] = get_avatar( $user->ID );
elseif( $fieldName == ‘login_url’ )
$replacements[ $key ] = wp_login_url();
elseif( $fieldName == ‘logout_url’ )
$replacements[ $key ] = wp_logout_url();
elseif( $fieldName == ‘lostpassword_url’ )
$replacements[ $key ] = wp_lostpassword_url();
elseif( $fieldName == ‘admin_url’ )
$replacements[ $key ] = admin_url();
elseif( $fieldName == ‘activation_url’ )
$replacements[ $key ] = self::userActivationUrl( ‘activate’, $user->ID, false );
elseif( $fieldName == ’email_verification_url’ )
$replacements[ $key ] = self::emailVerificationUrl( $user );
elseif( $fieldName == ‘login_form’ )
$replacements[ $key ] = self::lgoinForm();
elseif( $fieldName == ‘lostpassword_form’ )
$replacements[ $key ] = self::lostPasswordForm();
else
$replacements[ $key ] = @$user->$fieldName;
if( is_array( $replacements[ $key ] ) ) {
$replacements[ $key ] = implode( ‘,’, $replacements[ $key ] );}
}$data = str_replace($patterns, $replacements, $data);
}March 6, 2013 at 2:27 am #3241pointclearmedia
MemberIs this still broken? If I have multiple checkboxes under one um_field_container, how do I echo one of the values? I want a conditional statement like:
If the checkbox[array] = checked then…do something.
March 6, 2013 at 5:13 pm #3254Support
MemberHello,
With version 1.1.3rc3, if you add placeholder in your email notification area and the field was multiple checkbox, then field value will send as comma separated value.And for retrieving any extra field you can use get_user_meta function.
http://codex.wordpress.org/Function_Reference/get_user_metaIf checkbox have value, it will return array and for empty checkbox this will return null.
Thanks.
-
AuthorPosts
- You must be logged in to reply to this topic.