Prime Links

Hiding links for guests by a guest group - Prime Links

Hiding links for guests by a guest group

by urzh » Fri Nov 01, 2019 9:48 pm

Hello, I created a new group and copied the permissions from the default "guest" phpbb group to it. However, looks like when any user in that group logs into my site, they can still see external links, even though I have "Remove links for guests: enabled." How can I make it work this way?
urzh
Registered User
Posts: 126
Joined: Mon Aug 05, 2019 1:51 pm
Name: Robert
Contact:

Re: Hiding links for guests by a guest group

by primehalo » Sat Nov 02, 2019 12:53 am

My extension doesn't check for guest permissions, it checks for actual guests. To do what you want you would have to modify the source code in main_listener.php. You'd need to change this line to check for a specific permission rather than checking if the user is not registered:
$is_guest = empty($this->user->data['is_registered']);
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
User avatar
primehalo
Former Team Member
Posts: 2850
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: Hiding links for guests by a guest group

by urzh » Sat Nov 02, 2019 1:44 am

primehalo wrote:My extension doesn't check for guest permissions, it checks for actual guests. To do what you want you would have to modify the source code in main_listener.php. You'd need to change this line to check for a specific permission rather than checking if the user is not registered:
$is_guest = empty($this->user->data['is_registered']);

Specific permission, meaning a group? If so, would this work for my TEST group?

Code: Select all

$is_guest = empty($this->user->data['is_TEST']);
urzh
Registered User
Posts: 126
Joined: Mon Aug 05, 2019 1:51 pm
Name: Robert
Contact:

Re: Hiding links for guests by a guest group

by primehalo » Sat Nov 02, 2019 2:35 am

Unfortunately, no, that won't work. I don't remember off-hand how to check if a member is in a specific group.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
User avatar
primehalo
Former Team Member
Posts: 2850
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: Hiding links for guests by a guest group

by urzh » Sat Nov 02, 2019 9:25 am

When you say permission then, can you give me an example? Trying to understand how to frame it
urzh
Registered User
Posts: 126
Joined: Mon Aug 05, 2019 1:51 pm
Name: Robert
Contact:

Re: Hiding links for guests by a guest group

by primehalo » Sat Nov 02, 2019 4:01 pm

I wouldn't know which permission to check, I would specifically check if the user is in that specific group. I found some code in this post that shows about checking groups:
viewtopic.php?t=2272436

So I think it'd be something like this:

Code: Select all

global $phpbb_root_path, $phpEx;
		
if ( !function_exists('group_memberships') )
{
    include($phpbb_root_path . 'includes/functions_user.'.$phpEx);
}
if (group_memberships(GUESTGROUPID, $user->data['user_id'], true))
{
	$is_guest = true;
}
Replacing GUESTGROUPID with the ID of your guest group
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!
User avatar
primehalo
Former Team Member
Posts: 2850
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: Hiding links for guests by a guest group

by urzh » Sun Nov 03, 2019 12:36 pm

Thanks, I tried it but I don't this will do ultimately what I want. I will look for another way, appreciate it
urzh
Registered User
Posts: 126
Joined: Mon Aug 05, 2019 1:51 pm
Name: Robert
Contact:

Re: Hiding links for guests by a guest group

by urzh » Sun Nov 03, 2019 12:44 pm

I was able to do what I needed by granting additional permissions on the forums I have links I really don't want users accessing. Thanks.
urzh
Registered User
Posts: 126
Joined: Mon Aug 05, 2019 1:51 pm
Name: Robert
Contact: