Page 1 of 4

Hiding member list from guests

Posted: Thu May 04, 2006 9:20 pm
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

Posted: Thu May 04, 2006 9:27 pm
by entengo
Yeah, Setbb disabled Guests from viewing member lists. But in most forums. Guests can view it.

Posted: Thu May 04, 2006 9:27 pm
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;
	}

Posted: Fri Sep 22, 2006 3:22 am
by middle_road
Thanks Marshalrusty!

Posted: Tue Sep 26, 2006 3:10 am
by kyle1745
Great simple stuff, any chance of the code to block user groups the same way?

Posted: Tue Sep 26, 2006 3:12 am
by CyberGeek
Kyle1745 - Can you be more specific?

Posted: Tue Sep 26, 2006 3:15 am
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.

Posted: Tue Sep 26, 2006 3:15 am
by kyle1745
Honestly this is very simple stuff and should be a mod... cake and very effective.

Posted: Tue Sep 26, 2006 3:18 am
by Wo1f
hi kyle1745,

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


Regards,
Wolf

Posted: Tue Sep 26, 2006 3:20 am
by kyle1745
Yes but many of them conflict with other mods and this is a very simple solution.

Posted: Sat Sep 30, 2006 3:47 am
by kyle1745
Anyone? On how to redirect the usergroups links in the same manner?

Posted: Sat Sep 30, 2006 4:24 am
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

Posted: Sat Sep 30, 2006 4:32 am
by kyle1745
Perfect...

This thread should be a mod... very simple and effective.

Posted: Sat Sep 30, 2006 12:00 pm
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.

Posted: Sat Sep 30, 2006 4:59 pm
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