Hiding member list from guests

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
enviroweb
Registered User
Posts: 16
Joined: Thu Feb 02, 2006 6:40 pm

Hiding member list from guests

Post by enviroweb »

I was given information for V19 on hiding members from non-registered users. Are they still the same on v20? If not, could someone let me know what to do now?

Thanks
User avatar
entengo
Registered User
Posts: 37
Joined: Thu Feb 09, 2006 11:49 pm
Location: The Alamo
Contact:

Post by entengo »

Yeah, Setbb disabled Guests from viewing member lists. But in most forums. Guests can view it.
User avatar
Marshalrusty
Project Manager
Project Manager
Posts: 29334
Joined: Mon Nov 22, 2004 10:45 pm
Location: New York City
Name: Yuriy Rusko
Contact:

Post by Marshalrusty »

Same as before :)

Hide memberlist:
Open {root}/memberlist.php
Find:

Code: Select all

init_userprefs($userdata);
After, add:

Code: Select all

if ($userdata['user_id'] == ANONYMOUS)
{
redirect(append_sid('login.'.$phpEx));
}
Hide user profiles:
Open {root}/profile.php
Find:

Code: Select all

	if ( $mode == 'viewprofile' )
	{
		include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
		exit;
	}
Replace with:

Code: Select all

	if ( $mode == 'viewprofile' )
	{
		if ($userdata['user_id'] == ANONYMOUS)
		{
		redirect(append_sid('login.'.$phpEx));
		}

		include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
		exit;
	}
🇺🇦 Made in Ukraine, exported to the USA 🇺🇸

Have comments/praise/complaints/suggestions? Please feel free to PM me.

Need private help? Hire me for all your phpBB and web development needs
middle_road
Registered User
Posts: 1
Joined: Fri Mar 25, 2005 12:02 pm

Post by middle_road »

Thanks Marshalrusty!
kyle1745
Registered User
Posts: 173
Joined: Thu Nov 14, 2002 2:21 am

Post by kyle1745 »

Great simple stuff, any chance of the code to block user groups the same way?
CyberGeek
Registered User
Posts: 83
Joined: Fri Apr 14, 2006 5:30 am
Location: Coding Office
Contact:

Post by CyberGeek »

Kyle1745 - Can you be more specific?
Best Regards:
Aaron McGowan
kyle1745
Registered User
Posts: 173
Joined: Thu Nov 14, 2002 2:21 am

Post by kyle1745 »

The code in this thread redirects the links to the login page if you are not logged in. So the profile link and memberlist like go to the login page. Id like to get the same thing for the usersgroups link.
kyle1745
Registered User
Posts: 173
Joined: Thu Nov 14, 2002 2:21 am

Post by kyle1745 »

Honestly this is very simple stuff and should be a mod... cake and very effective.
Wo1f
Registered User
Posts: 2039
Joined: Fri Jan 28, 2005 3:20 am

Post by Wo1f »

hi kyle1745,

It's actually integrated in many MODs currently in the MODs database. :wink:


Regards,
Wolf
kyle1745
Registered User
Posts: 173
Joined: Thu Nov 14, 2002 2:21 am

Post by kyle1745 »

Yes but many of them conflict with other mods and this is a very simple solution.
kyle1745
Registered User
Posts: 173
Joined: Thu Nov 14, 2002 2:21 am

Post by kyle1745 »

Anyone? On how to redirect the usergroups links in the same manner?
Wo1f
Registered User
Posts: 2039
Joined: Fri Jan 28, 2005 3:20 am

Post by Wo1f »

Open this file --> yourforumroot\groupcp.php


FIND this code:

Code: Select all

// End session management
//

AFTER, ADD this code:

Code: Select all

if ( $userdata['user_id'] == ANONYMOUS )
{
	redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx", true));
	exit;
}

Regards,
Wolf
kyle1745
Registered User
Posts: 173
Joined: Thu Nov 14, 2002 2:21 am

Post by kyle1745 »

Perfect...

This thread should be a mod... very simple and effective.
geesee
Registered User
Posts: 127
Joined: Fri Jun 16, 2006 9:56 pm

Post by geesee »

Wo1f wrote: Open this file --> yourforumroot\groupcp.php


FIND this code:

Code: Select all

// End session management
//

AFTER, ADD this code:

Code: Select all

if ( $userdata['user_id'] == ANONYMOUS )
{
	redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx", true));
	exit;
}

Regards,
Wolf


When changing the code like this does it matter if what you end up with looks exactly like your example or like this (see below, re: spaces in between stuff and the number of lines used)?

AFTER, ADD this code:

Code: Select all

if ( $userdata['user_id'] == ANONYMOUS ) { redirect(append_sid ("login.$phpEx?redirect=groupcp.$phpEx", true)); exit; }
I am new at this and don't want to f it up.
Wo1f
Registered User
Posts: 2039
Joined: Fri Jan 28, 2005 3:20 am

Post by Wo1f »

Hi geesee.
geesee wrote: When changing the code like this does it matter if what you end up with looks exactly like your example or like this (see below, re: spaces in between stuff and the number of lines used)?


Your "one-line" version should be good to go (in this specific case), but as a rule of thumb, you should not change the structure of any code unless you know what you're doing. There's also the legibility factor which should not be overlooked for the sake of reducing the # of lines. If you were submitting a MOD to be validated, you would have to take this into consideration.

Regards,
Wolf
Locked

Return to “2.0.x Support Forum”