Checking Group Permissions

Discussion forum for MOD Writers regarding MOD Development.
Locked
User avatar
forumace
Registered User
Posts: 6
Joined: Mon Nov 17, 2008 5:57 am
Contact:

Checking Group Permissions

Post by forumace » Mon Nov 17, 2008 12:37 pm

While posting I want to check the group a user belongs to. If the User belongs to 'x' group then...

I want this to be added to posting.php so I can decide which registered members avoid the captcha in the following code:

if ($config['enable_post_confirm'] && !(of group 'x') && $solved_captcha === false && ($mode == 'post' || $mode == 'reply' || $mode == 'quote'))
A Detailed Medieval Text Adventure
Do not just read the story, become it, and decide the ending.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51433
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Checking Group Permissions

Post by Brf » Mon Nov 17, 2008 12:47 pm

That posting captcha is only for Guests, meaning it is only for users who are not logged in.
Therefore, they are not a member of any group other than Guests.

User avatar
forumace
Registered User
Posts: 6
Joined: Mon Nov 17, 2008 5:57 am
Contact:

Re: Checking Group Permissions

Post by forumace » Mon Nov 17, 2008 12:57 pm

I know, but if you do this:

Code: Select all

if ($config['enable_post_confirm']  && $solved_captcha === false && ($mode == 'post' || $mode == 'reply' || $mode == 'quote'))
Then the CAPTCHA is for all. Basically I want registered members to still have to input the CAPTCHA, but not certain groups, any help will be appreciated, pretty please. Thanks.
A Detailed Medieval Text Adventure
Do not just read the story, become it, and decide the ending.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51433
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Checking Group Permissions

Post by Brf » Mon Nov 17, 2008 1:05 pm

You can user group_memberships() to find out what groups a user belongs to...

For instance, if you want to enable the captcha for groups 69 and 111 you would use:

Code: Select all

group_memberships(array(69,111), $user->data['user_id'], true)
Which would return true if the user belongs to either group.

User avatar
forumace
Registered User
Posts: 6
Joined: Mon Nov 17, 2008 5:57 am
Contact:

Re: Checking Group Permissions

Post by forumace » Mon Nov 17, 2008 1:21 pm

Thanks much, but how will I call that from posting.php as group_memberships() is an undefined function there.
A Detailed Medieval Text Adventure
Do not just read the story, become it, and decide the ending.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51433
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Checking Group Permissions

Post by Brf » Mon Nov 17, 2008 2:41 pm

In posting.php, look for:

Code: Select all

		include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
and remove it from there, and put it at the top after the other includes.

User avatar
forumace
Registered User
Posts: 6
Joined: Mon Nov 17, 2008 5:57 am
Contact:

Re: Checking Group Permissions

Post by forumace » Mon Nov 17, 2008 4:12 pm

Thanks very much that worked very well for me. I could just kiss you, but that is not allowed so, just accept my thanks ;).
A Detailed Medieval Text Adventure
Do not just read the story, become it, and decide the ending.

Locked

Return to “[3.0.x] MOD Writers Discussion”

Who is online

Users browsing this forum: beutheme, geankevin and 16 guests