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
geesee
Registered User
Posts: 127
Joined: Fri Jun 16, 2006 9:56 pm

Post by geesee »

Thanks for getting back to me.

The problem is when I open up a file to make alterations I'm doing it in Notepad which doesn't display the code in the same way I'm seeing it in the instructions in these forums. As a result, I'm having difficulty figuring out where to put the spaces and line breaks, etc., in.

Any help would be great since, as is, the altered code I have at the moment isn't doing what it's supposed to.
Wo1f
Registered User
Posts: 2039
Joined: Fri Jan 28, 2005 3:20 am

Post by Wo1f »

Go get yourself a copy of this rudimentary text editor (complete with line numbering) and for a very modest fee. It's free!
  • Araneae
[/url]

Regads,
Wolf
geesee
Registered User
Posts: 127
Joined: Fri Jun 16, 2006 9:56 pm

Post by geesee »

Wo1f wrote: Go get yourself a copy of this rudimentary text editor (complete with line numbering) and for a very modest fee. It's free!
  • Araneae
[/url]

Regads,
Wolf


Wolf,

Thanks for trying to help me out.

I just re-did the changes in Wordpad and it fixed the problem.

Halleluiah! :D
Wo1f
Registered User
Posts: 2039
Joined: Fri Jan 28, 2005 3:20 am

Post by Wo1f »

Your welcome and good luck to you!

Regards,
wolf
User avatar
seolpo
Registered User
Posts: 50
Joined: Fri Dec 23, 2005 7:11 pm
Contact:

Post by seolpo »

thanks very much :D
GoEdwin
Registered User
Posts: 17
Joined: Wed Dec 13, 2006 7:50 am
Location: TN
Contact:

Post by GoEdwin »

Marshalrusty!!! I just wanted to THANK YOU for making it so easy to change the code. Your ADD and REPLACE code instructions are simple and to the point. I used your code here to hide the profiles and memberlist to guests.

Kudos to you. Now, if i had THAT easy a set of instructions on how to upgrade my forum... I'd do it. Until then, I'm just gonna wait.

Bowing,
Angie
stevepm
Registered User
Posts: 111
Joined: Fri Aug 26, 2005 4:39 pm
Contact:

Post by stevepm »

This may be a daft question but is there anyway to set these so members of a certain user group can’t view them
quartzster
Registered User
Posts: 2
Joined: Sun Dec 24, 2006 2:00 pm

Post by quartzster »

Marshalrusty,

thanks so much for the easy to follow instructions...worked like a charm

I would like to be able to "hide" the "Who is online section" in a similar manner so that the only ones who see it are registered users.
User avatar
Marshalrusty
Project Manager
Project Manager
Posts: 29278
Joined: Mon Nov 22, 2004 10:45 pm
Location: New York City
Name: Yuriy Rusko
Contact:

Post by Marshalrusty »

Open {root}/templates/your template/index_body.tpl
Find:

Code: Select all

<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
  <tr> 
	<td class="catHead" colspan="2" height="28"><span class="cattitle"><a href="{U_VIEWONLINE}" class="cattitle">{L_WHO_IS_ONLINE}</a></span></td>
  </tr>
  <tr> 
	<td class="row1" align="center" valign="middle" rowspan="2"><img src="templates/subSilver/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>
	<td class="row1" align="left" width="100%"><span class="gensmall">{TOTAL_POSTS}<br />{TOTAL_USERS}<br />{NEWEST_USER}</span>
	</td>
  </tr>
  <tr> 
	<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} &nbsp; [ {L_WHOSONLINE_ADMIN} ] &nbsp; [ {L_WHOSONLINE_MOD} ]<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>
  </tr>
</table>

<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
	<td align="left" valign="top"><span class="gensmall">{L_ONLINE_EXPLAIN}</span></td>
</tr>
</table>
Replace with:

Code: Select all

<!-- BEGIN switch_user_logged_in -->
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
  <tr> 
	<td class="catHead" colspan="2" height="28"><span class="cattitle"><a href="{U_VIEWONLINE}" class="cattitle">{L_WHO_IS_ONLINE}</a></span></td>
  </tr>
  <tr> 
	<td class="row1" align="center" valign="middle" rowspan="2"><img src="templates/subSilver/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" /></td>
	<td class="row1" align="left" width="100%"><span class="gensmall">{TOTAL_POSTS}<br />{TOTAL_USERS}<br />{NEWEST_USER}</span>
	</td>
  </tr>
  <tr> 
	<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} &nbsp; [ {L_WHOSONLINE_ADMIN} ] &nbsp; [ {L_WHOSONLINE_MOD} ]<br />{RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>
  </tr>
</table>

<table width="100%" cellpadding="1" cellspacing="1" border="0">
<tr>
	<td align="left" valign="top"><span class="gensmall">{L_ONLINE_EXPLAIN}</span></td>
</tr>
</table>
<!-- END switch_user_logged_in -->
Open {root}/viewonline.php
Find:

Code: Select all

init_userprefs($userdata);
After, add:

Code: Select all

if ($userdata['user_id'] == ANONYMOUS)
{
	redirect(append_sid("login.$phpEx?redirect=viewonline.$phpEx", true)); 
}
Have comments/praise/complaints/suggestions? Please feel free to PM me.

Need private help? Hire me for all your phpBB and web development needs
quartzster
Registered User
Posts: 2
Joined: Sun Dec 24, 2006 2:00 pm

Post by quartzster »

thank you

very much appreciated
novedad
Registered User
Posts: 4
Joined: Thu Mar 29, 2007 6:31 am

Re: Hiding member list from guests

Post by novedad »

Hi There,

Very new at this & hoping somebody can help me.

I wanted to hide the members list from unregistered visitors.

I made the following changes.
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;
}


All went well...

However now nobody can see the members list. Admin included.

Any ideas on where i may have gone wrong?
User avatar
stevemaury
Support Team Member
Support Team Member
Posts: 51403
Joined: Thu Nov 02, 2006 12:21 am
Location: The U.P.
Name: Steve
Contact:

Re: Hiding member list from guests

Post by stevemaury »

Here is the code:

Code: Select all

# 
#This restricts the memberlist to registered users only. 
#-----[ OPEN ]------------------------------------------ 
# 

memberlist.php 

# 
#-----[ FIND ]------------------------------------------ 
# 
  
// 
// End session management 
// 

# 
#-----[ AFTER, ADD ]------------------------------------ 
# 

// Begin 'Restrict Access' 
if ( !$userdata['session_logged_in'] ) 
   { 
      redirect(append_sid("login.".$phpEx."?redirect=memberlist.".$phpEx, true)); 
      exit; 
   } 
// End 'Restrict Access' 
For REALLY good and VERY inexpensive hosting CLICK HERE

I can stop all your spam. I can upgrade or update your Board. PM or email me. (Paid support)
novedad
Registered User
Posts: 4
Joined: Thu Mar 29, 2007 6:31 am

Re: Hiding member list from guests

Post by novedad »

Thank you very much, it now works perfectly :D
arianitb
Registered User
Posts: 29
Joined: Sun Mar 27, 2005 7:42 am

Re: Hiding member list from guests

Post by arianitb »

these cods are great !!
but is there one to redirect to logg in from the "Search" for unregisterd users also? or did i accedently skip that one?
User avatar
JMaclean
Registered User
Posts: 28
Joined: Wed Feb 28, 2007 8:17 pm
Location: Socal
Contact:

Re: Hiding member list from guests

Post by JMaclean »

This looks great, now, I really have to show my ignorance, what file gets this code??

I have not looked at the code of ANY of my files, just glad to have the board up and running, but I dont think visitors need to see who the members are and this looks good to me!

TIA!!

- John -
Locked

Return to “2.0.x Support Forum”