• Resolved Nono

    (@tombstones)


    I noticed that the phone (I put a check on Day Phone) gets printed instead of the email address in the new member application notification email. The current code in wp-members/wp-members-email.php is

    if ($wpmem_fields[$row][2] != 'user_email') {
    				if ($wpmem_fields[$row][2] == 'user_url') {
    					$val  = $user->user_url;
    				} else {
    					$val  = get_user_meta($user_id,$wpmem_fields[$row][2],'true');
    				}
    			}

    which does nothing if the meta is user_email. (It only tests if it’s NOT user_email.) So I changed the code to

    if ($wpmem_fields[$row][2] != 'user_email') {
    				if ($wpmem_fields[$row][2] == 'user_url') {
    					$val  = $user->user_url;
    				} else {
    					$val  = get_user_meta($user_id,$wpmem_fields[$row][2],'true');
    				}
    			}
    			else {
    				$val = $user->user_email;
    			}

    which will update $val instead of just copying the last (and NOT updated) meta value which in my case is Day Phone.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chad Butler

    (@cbutlerjr)

    Thanks for bringing this up. It’s actually something that I have fixed in the upcoming new release.

    However, the correction is actually as follows:

    if ($wpmem_fields[$row][2] != 'user_email') {
    				if ($wpmem_fields[$row][2] == 'user_url') {
    					$val  = $user->user_url;
    				} else {
    					$val  = get_user_meta($user_id,$wpmem_fields[$row][2],'true');
    				}
    
    				$body.= "$name: $val \r\n";
    
    			}

    The reason that the condition only tests that it’s NOT email is because the email is already included earlier in the message. So when that condition was added, it was actually intended for the $body.= "$name: $val \r\n"; to be inside the curly braces so that it would skip email in the loop since it would be redundant. As email is actually in the user table rather than the meta table, we are able to pull it directly.

    Hope that makes sense.

    Thread Starter Nono

    (@tombstones)

    Hey there.

    Appreciate you answering this quickly. I also noticed that email is repeated but I thought it’s ok as long as it works and that’s how he/you programmed it. I just wanted to eliminate the repeated value and maintain the presentation.

    Excellent plugin you have! Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WP-Members] Phone instead of Email posted in email to admin’ is closed to new replies.