Forums

Check if email is null (6 posts)

  1. caudillc
    Member
    Posted 3 years ago #

    Since Facebook Connect allows the creation of a user without an email address, I have been trying to code to give an error to the user to add on to their profile. What php calls this? Again, I have tried hundreds of options.

    if ($user_email = ''){
    echo "Email Address Missing";
    }else{}

    I have tried calling out their info too, but have not done it correctly.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    I don't know anything about Facebook Connect but there's a typo in your code above.

    if ($user_email = ''){

    should be

    if ($user_email == ''){

  3. caudillc
    Member
    Posted 3 years ago #

    oops - just a typo on the post. the problem has nothing really to do with FB Connect. I just want to check to see if the e-mail field in the database is blank or not. The code above is not looking in the right place...and I am not sure what else to try.

  4. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    get_the_author_email()?

    Not much documentation in it within the Codex other than it is the same as the_author_email(), except it returns rather than displays the author's e-mail address.

  5. caudillc
    Member
    Posted 3 years ago #

    it is not necessarily the author - more so the logged in user...

    i think it may need some variation of this, but i am not certain about it:

    $current_user = wp_get_current_user();
    $user_id = $current_user->ID;

  6. mark9425
    Member
    Posted 3 years ago #

    The codex does list the get_currentuserinfo as one way of accessing this information as well. See below:

    http://codex.wordpress.org/Function_Reference/get_currentuserinfo

Topic Closed

This topic has been closed to new replies.

About this Topic