Restrict User Sign Ups

This topic contains 15 replies, has 4 voices, and was last updated by  Stiofan O’Connor 6 years, 6 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #677

    Ian Manson
    Expired Member
    Post count: 37

    Hi Guys,

    A quick question regarding this add on. I have a requirement to restrict sign ups to only one domain email address (ie. @mycompany.com) Is it possible to restrict ALL other domains with this addon?

    Ian

    #681

    Giri
    Expired Member
    Post count: 3155

    Hi Ian,

    No thats not possible with that addon.

    But you can use wordpress filter for that.

    
    
    add_filter( 'is_email', 'uwp_restrict_email_custom', 10, 2 );
    function uwp_restrict_email_custom( $valid, $email ) {
    	if ( strpos( $email, '@mycompany.com' ) !== true ) {
    		$valid = false;
    	}
    	return $valid;
    }
    #832

    Ian Manson
    Expired Member
    Post count: 37

    Thanks Giri, is it possible for you to add restrict users signups to my membership? It’s not on my downloads list

    #834

    Paolo
    Site Admin
    Post count: 31206

    Hi Ian,

    I’m sorry, that add-on has been added after you bought the subscription and should have been added retroactively to all members. I’m not sure why it didn’t, but I asked to Stiofan to verify.

    He’s flying back home right now and I think he’ll be able to check this before the end of the day only.

    We’ll let you know asap and sorry again about any inconvenience!

    Actually thanks for letting us know about the problem.

    #835

    Ian Manson
    Expired Member
    Post count: 37
    This reply has been marked as private.
    #836

    Paolo
    Site Admin
    Post count: 31206
    This reply has been marked as private.
    #841

    Ian Manson
    Expired Member
    Post count: 37

    Thanks Paolo for that.

    Going back to the original solution to the problem, the add_filter solution. I’ve tried adding it to the active themes functions.php and it is not working, nor did a similar code from another source. Am I adding this to the wrong place?

    Ian

    #842

    Paolo
    Site Admin
    Post count: 31206

    better would be in a code snippet, but functions.php is not wrong.

    I asked to developers to check why it isn’t working.

    If you provide a link and admin credentials in a private reply, they’ll be able to follow up faster.

    Let us know,

    #843

    Ian Manson
    Expired Member
    Post count: 37
    This reply has been marked as private.
    #844

    Ian Manson
    Expired Member
    Post count: 37

    I’ve just tried adding the code with the snippet plugin as well as still no luck. It still accepts registrations from any email domain

    #845

    Ian Manson
    Expired Member
    Post count: 37

    Ah disregard. Helps if you activate the snippet! All working now, thank you again Paolo

    #846

    Paolo
    Site Admin
    Post count: 31206

    Glad its fixed! 🙂

    #847

    Ian Manson
    Expired Member
    Post count: 37
    This reply has been marked as private.
    #852

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Ian,

    I have now updated your membership to include all the latest releases.

    I have also updated your code snippet to the below one which will do what you want.

    
    
    add_filter( 'is_email', 'uwp_restrict_email_custom', 10, 2 );
    function uwp_restrict_email_custom( $valid, $email ) {
    	if ( strpos( $email, '@mycompany.com' ) === false ) {
    		$valid = false;
    	}
    	return $valid;
    }

    If i can help further just let me know.

    Thanks,

    Stiofan

    #853

    Ian Manson
    Expired Member
    Post count: 37

    Perfect, thanks Stiofan

Viewing 15 posts - 1 through 15 (of 16 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket