Skip to main content
Topic: [Solved] Restrict registering (Read 6796 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[Solved] Restrict registering

My request is a little bit exceptional I think. For a private community, only available for employees, we have to ensure that only one specific emailadress should accepted for registration. Quasi to change the E-MailBan to the opposite. Thanks in advance for your thoughts.  :)

Regards
NetFlag
Last Edit: December 02, 2013, 05:22:49 am by NetFlag

Re: Restrict registering

Reply #1

Hmmm. Looks like more than one file must be touched:
sources/controllers/Register.controller.php
sources/subs/Members.subs.php
sources/Security.php

More difficult than expected.  :-\

Re: Restrict registering

Reply #2

In theory (not tried) you should be able to do it just using the hook: integrate_register_check

That hook passes two arrays: $regOptions and $reg_errors
Then you can do something like:
Code: [Select]
function only_valid_emails($regOptions, $reg_errors)
{
    // if $regOptions['email'] is NOT valid
    // $reg_errors->addError(array('email_notallowed', array(htmlspecialchars($regOptions['email'], ENT_COMPAT, 'UTF-8'))), 1);
}
And then you define "somwhere" a $txt['email_notallowed'].

ETA: and if it doesn't work...it's probably a bug! :P
Last Edit: December 02, 2013, 05:16:11 am by emanuele
Bugs creator.
Features destroyer.
Template killer.

Re: Restrict registering

Reply #3

Thanks for reply emanuele! In meantime I handle it out just edit one line of code in sources/Security.php:
Find:
Code: [Select]
WHERE {string:email} LIKE bi.email_address
replace with:
Code: [Select]
WHERE {string:email} NOT LIKE bi.email_address

And than set settings in Members -> Add new ban
Ristrictions:
Partial ban | Cannot register

Ban on Email Address:
Code: [Select]
*@xxxx.xx

That do exactly what I want. Hope my solution can help someone else!

[1]
Yeah. Solved by oneself.  ;D