PDA

View Full Version : Only allow invited users...


WonderMonkey
11-30-2002, 03:02 AM
You know I KNOW this has got to have been asked before but I cannot find it via the search feature.

I am looking to restrict members of my board to those who are invited. It can either be:
1 - You have to have the proper code to create a user <- Easiest
2 - Be sent an email inviting you to create a user.

Or something that achieves the same results.

I am going to be shocked if this has not been done yet.

Regards,
WM

Logician
11-30-2002, 04:30 PM
1- Edit the template "registeradult" and insert an HTML form field like this into somewhere before </form>:
<normalfont>Password to register:<input type="text" name="specialpassword"></normalfont>
(You can spice up the design)

2-Then edit register.php, find:

if (!$allowregistration) {
eval("standarderror(\"".gettemplate("error_noregister")."\");");
exit;
}


after that add:

if ($specialpassword!='XXX') {
eval("standarderror(\"".gettemplate("error_inviteonly")."\");");
exit;
}

(Replace X with your special password)

Create a templated named "error_inviteonly" and enter your error message there. This will be displayed if the member didnt enter the correct password for registering.. Notice the password is case sensitive..

Enjoy..

WonderMonkey
12-01-2002, 12:14 AM
Excellent. Thanks for the code. I am a developer but non-php at the moment and that follow pretty much what I envisioned as the "hard-coded" method.

Thanks for the post.

WonderMonkey
12-01-2002, 12:53 AM
I had to change it a bit. When I implemented your code I would get the error message as soon as someone clicked on the "register" link to begin the process. I was able to look at the code and figure out enough to do the following"

In register.php

// This is the Registration Code
if ($action=="addmember") {
if ($specialpassword!='XXX') {
eval("standarderror(\"".gettemplate("error_inviteonly")."\");");
exit;
}
}


Of course I may have implemented your code incorrectly to start with.

Thanks for pushing me most of the way!

Logician
12-01-2002, 08:14 AM
Actually my code is correct too but I did not notice there are 3 instances of the "if (!$allowregistration) {" part in register.php. What I meant was the one after "if ($HTTP_POST_VARS['action']=="addmember") {" section but you already figured that out. :)

WonderMonkey
12-01-2002, 02:25 PM
Ah! Well good! I was thinking it was implementation on my part.

Thanks again for the code.