• Joshua

    (@shermanator)


    Is it possible to check a user’s email by domain?

    For instance I want to only allow users with “@somedomain.com” in their email to see a series of posts. If it’s feasible I’d rather go that way instead of having to upload a huge list of names with one common email domain.

Viewing 2 replies - 1 through 2 (of 2 total)
  • https://codex.www.ads-software.com/Function_Reference/get_userdata

    https://codex.www.ads-software.com/Function_Reference/get_currentuserinfo

    These will allow you to get the email and you can then check the domain,

    Which one to use will depend of course on which route you take;

    You could check a users email upon registration and give the user a role that will allow viewing of the posts.

    or

    When a user tries to view a post, you can check the current user’s email and allow him to view the current post or redirect him to something else.

    It also depends if the posts you mention are ALL the posts on the site, or just some.

    Thread Starter Joshua

    (@shermanator)

    Thanks for the response, wpfan!

    Once the current user info is retrieved I presently have the validator structured as
    if(is_email(‘*@some-domain.com’)){show content}
    else {redirect/block content}

    Question is will WP acknowledge a wildcard designator so that only the domain is actually checked rather than the username?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Check email by domain’ is closed to new replies.