PDA

View Full Version : Pre-approval of permissions solution? I'm stuck.


BLykMik
07-27-2005, 05:50 PM
I can't figure out a solution to this issue and was direct here from the vBulletin forums...

We're about to open up our forums to a specific client's user group (about 120+ people). The access will be to a "private" forum we currently have set up.

The only way I can give user's permission to the private forum (that I know of) is to adjust thier permission as soon as they sign up...

...but that would obviously cause a delay in their access... and could be discouraging to their participation in the forum. For many of these users, it will be their first time accessing a forum community.

I do have a list of all of the groups emails and was planning on telling them all to use that email to sign up. I planning on trying to stay on top of it and going through and give the access as fast as possible.... but obviously, most will have left (and not seen all there is to see in the private forum).

So, is there a solution to this issue? It is early, so I can try anything...

Is there any way to "pre-allow" permissions to users that register with a specified email address?

Or any other solution to giving immediate access? Unfortunately, it is a private client area, so I can't leave it open to the public.

working with: vBulletin Version 3.0.7

Andreas
07-27-2005, 05:59 PM
Easy approach:
- Create a Datastore Record with a comma-separated List of all eMail-Adresses
- Load this in register.php
- Upon Account activation, explode this list into an array, in_array($useremail, $list)
- If true, assign an additional Usergroup that has access rights

BLykMik
07-27-2005, 06:11 PM
Thanks... I was scared someone might say that. ;)

I really don't know any coding (I probably should have mentioned that in the original post)... I was just direct here from the main vbulletin site.

Actually, I think I understand exactly what you are telling me to do, I just wouldn't even know where to start to actually execute it. Thanks though.

Andreas
07-27-2005, 06:51 PM
INSERT INTO datastore (title, data) VALUES ('emaillist', 'email1@domain1.com,email1@domain2.com,email3@doma in3.com')


In register.php
FIND

'banemail'
);


REPLACE that with

'banemail',
'emaillist'
);


FIND

// ### DO THE UG/TITLE UPDATE ###


If you want an additional Usergroup:
ABOVE that ADD

$emails = explode(',', $datastore['emaillist']);
if (in_array($userinfo['email'], $emails) AND $user['usergroupid'] == 2)
{
$dotitle .= ", membergroupids=IF(membergroupids='', 'X', CONCAT_WS(',', membergroupids, 'X'))";
}


If you want another Primary Usergroup instead:
ABOVE that ADD

$emails = explode(',', $datastore['emaillist']);
if (in_array($userinfo['email'], $emails) AND $user['usergroupid'] == 2)
{
$user['usergroupid'] = X;
}


X must obviously be replaced with the Usergroupid that has access rights ;)

Untested, but should work.

BLykMik
07-27-2005, 08:03 PM
What the heck... I'll give it a try... Thanks!

Marco van Herwaarden
07-27-2005, 08:03 PM
Hmm shouldn't that implode be an explode?

Andreas
07-27-2005, 08:06 PM
/me should call $vbulletin->get_some_sleep() soon ...
Of course it should have been explode()

BLykMik
07-27-2005, 08:24 PM
INSERT INTO datastore (title, data) VALUES ('emaillist', 'email1@domain1.com,email1@domain2.com,email3@doma in3.com')


Quick question on the above... When I enter information into datastore, what does "(title, data)" reffer to? Is that something I should name specifically?

I've run a sql query once before, but it was on a different domain, and I believe the hosting company had a tool for it. I'm going through the instruction link now...

That is the only part that I'm really flying completely blind on.

Thanks.

Marco van Herwaarden
07-27-2005, 08:27 PM
title, data are the column names in the table, and should not be changed.

BLykMik
07-27-2005, 08:36 PM
Thanks... i got it... it is "emaillist" that is the specific name for the datastore.

BLykMik
07-29-2005, 04:48 PM
Follow up question...

As a datastore newbie, I was wondering 2 things...

1.) Can I substitute another name for emaillist?

and

2.) How would I (later) add another group like this? (say for another client's private list)

--Thanks

Andreas
07-29-2005, 05:12 PM
1) Yes. Make sure you replace all references
2) Well, the same way - just use another variable name

BLykMik
08-02-2005, 11:48 PM
Oops.. thought I had an error...

It is all good (so far)...

EDITED POST.

Can I get a little clarification on this:

I'm want to simply add permission to user group 12 to all the people on the list (in addition to registered user default privaleges).

If I read it right, it should look like this?

$emails = explode(',', $datastore['emaillist']);
if (in_array($userinfo['email'], $emails) AND $user['usergroupids'] == 2)
{
$dotitle .= ", membergroupids=IF(membergroupids='', '12', CONCAT_WS(',', membergroupids, '12'))";
}
I'm only changing the two "X" to 12... Is this correct?

I've now tried with the above code and, while I get NO errors, the users are NOT given the permissions that they are supposed to be given.

What could I be doing wrong?

Andreas
08-03-2005, 01:00 AM
$user['usergroupid'], not $user['usergroupids']

BLykMik
08-03-2005, 01:30 AM
I took the "s" out, but it still doesn't seem to give the permission.

Do I need to change membergroupid"s" also?

Andreas
08-03-2005, 01:36 AM
No, membergroupids is correct.

Did you put 'emaillist' into array $specialtemplates?

BLykMik
08-03-2005, 02:08 AM
no... will that help?

BINGO! That did it. I appreciate all your help. Thank you very much!

Kirk Y
08-03-2005, 03:27 AM
Hey! Are you the same BLykMik from Playstation.com? I've used your post on SOCOM III on my site. I thought it kinda funny to see you here, so thought I'd drop a hello!

BLykMik
08-03-2005, 03:47 PM
yup... that's me :)