WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members
[resolved] Phone instead of Email posted in email to admin (3 posts)

  1. Nono
    Member
    Posted 3 years ago #

    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.

  2. Chad Butler
    Member
    Plugin Author

    Posted 3 years ago #

    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.

  3. Nono
    Member
    Posted 3 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags