Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to check if a member’s email address contains certain words


  • Anton
    Participant

    @antonrsa

    I want to create a function to check if a member’s email address contains a word eg: test@mydomain.com (test) and then redirect the user to their settings page to change their email address. How do I get the currently logged in member’s email address in the wp_users db table?

Viewing 4 replies - 1 through 4 (of 4 total)

  • nit3watch
    Participant

    @nit3watch

    @antonrsa Iv’e got the wpmu dev Content Monitor plug-in, have a look at the plug-in at their site ( http://premium.wpmudev.org/project/content-monitor ) and let me know if it could help you, though I would ask that if you modify the plug-in you release it to the respiratory.

    It should be a good base to do what you want to do.


    Anton
    Participant

    @antonrsa

    Thanks @nit3watch

    It might work but what I’m looking for is a way to check if a user has logged in/registered with their Twitter account. When you register via Twitter (using the Twit Connect plugin) your email address is saved in wp_users as changeme.username@yourdomain.com. I want to add a function that checks if the user logged in via Twitter or checks their email address for the words changeme in their email address and then redirect them to the edit email settings page. Just need a way to get the users email address for the current logged in user.


    Boone Gorges
    Keymaster

    @boonebgorges

    Try something like this, Anton:
    `function boone_get_current_email() {
    global $current_user;
    get_currentuserinfo();

    if ( strpos( $current_user->user_email, ‘changeme.username@yourdomain.com’ ) !== false ) {
    $redirect = ‘whatever your redirect URL is’;
    wp_redirect( $redirect );
    }
    }
    add_action( ‘plugins_loaded’, ‘boone_get_current_email’ );`

    Totally off the top of my head and untested, but you get the idea. You might have to play with where you hook it (plugins_loaded is just a guess) so that the redirect works properly.


    Anton
    Participant

    @antonrsa

    Thanks @boonebgorges

    Will give it a try

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to check if a member’s email address contains certain words’ is closed to new replies.
Skip to toolbar