Page 1 of 2

Hide [ Profile | PM | WWW | AIM ] from guest?

Posted: Sat Oct 07, 2006 1:30 am
by Sassy
How can I remove [ Profile | PM | WWW | AIM ] panel from Guest users?

I tried to use the tags below, but ends up even registered users wont be able to see it.
<!-- BEGIN switch_user_logged_in -->
<!-- END switch_user_logged_in -->



What am I doing wrong?

Code: Select all

<td valign="middle" nowrap="nowrap">{postrow.POSTER_ONLINE_STATUS_IMG} <!-- BEGIN switch_user_logged_in --> {postrow.PROFILE_IMG} {postrow.PM_IMG} {postrow.EMAIL_IMG} {postrow.WEBLOG_IMG} {postrow.WWW_IMG} {postrow.AIM_IMG} {postrow.YIM_IMG} {postrow.MSN_IMG} {postrow.EBAY_IMG} 
				  <script language="JavaScript" type="text/javascript"><!-- 

if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 && navigator.userAgent.indexOf('6.') == -1 )
		document.write(' {postrow.ICQ_IMG}');
	else
		document.write('</td><td>&nbsp;</td><td valign="top" nowrap="nowrap"><div style="position:relative"><div style="position:absolute">{postrow.ICQ_IMG}</div><div style="position:absolute;left:3px;top:-1px">{postrow.ICQ_STATUS_IMG}</div></div>');
				
				//--></script><noscript>{postrow.ICQ_IMG}</noscript> <!-- END switch_user_logged_in --></td>

Posted: Sat Oct 07, 2006 1:41 am
by Brf
Hmmm.... but a switch is a group variable. You are nesting a group variable within the postrow group variable. I do not believe that will work. You will need to create a postrow.switch_user_logged_in as a new subgroup under postrow.

Posted: Sat Oct 07, 2006 4:49 am
by Zarath
For the viewtopic part, you need to open your viewtopic.php file and find the variables being set... something like

$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id");

and before that add...

if ( $userdata['user_id'] != ANONYMOUS )
{

then after the line that starts like
$yim = ( ( $postrow[$i]['user_yim'] )

add
}


for the other things, profile, etc... open memberlist.php, includes/usercp_viewprofile.php and add at the top, after the variable intialization etc...

if ( !$userdata['session_logged_in'] )
{
$redirect = "memberlist.$phpEx";
$redirect .= ( isset($_REQUEST['type']) ) ? '&mode=' . $_REQUEST['mode'] : '';
header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true));
}

[example for memberlist... alter the redirect for viewprofile etc]

Posted: Sat Oct 07, 2006 8:53 am
by igorw
Zarath wrote: For the viewtopic part, you need to open your viewtopic.php file and find the variables being set... something like

$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id");

and before that add...

if ( $userdata['user_id'] != ANONYMOUS )
{

then after the line that starts like
$yim = ( ( $postrow[$i]['user_yim'] )

add
}


for the other things, profile, etc... open memberlist.php, includes/usercp_viewprofile.php and add at the top, after the variable intialization etc...

if ( !$userdata['session_logged_in'] )
{
$redirect = "memberlist.$phpEx";
$redirect .= ( isset($_REQUEST['type']) ) ? '&mode=' . $_REQUEST['mode'] : '';
header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true));
}

[example for memberlist... alter the redirect for viewprofile etc]


Following the coding standards, you should use $HTTP_GET_VARS / $HTTP_POST_VARS and redirect(), that can be found in functions.php :)

Posted: Sat Oct 07, 2006 1:03 pm
by Zarath
Yeah, you should... but I didn't write it up, I just copied it from an old mod I did (that did the same thing she was asking for). ;)

Just delete that line entirely
$redirect .= ( isset($_REQUEST['type']) ) ? '&mode=' . $_REQUEST['mode'] : '';

Doesn't even do anything... heh.


Although the difference between redirect and header location is nil. They both do the same thing, but for Coding Standard's sake...

redirect("login.$phpEx?redirect=$redirect", true);
instead of
header('Location: ' . append_sid("login.$phpEx?redirect=$redirect", true));

Posted: Sat Oct 07, 2006 3:30 pm
by Sassy
Ok, now im really confused
lol

This redirects users to a login page if they click on the buttons?

I was looking to just hide it from guest, so search engines rank would go higher instead of indexing double content each time they are directed to the login page. also wanted to hide the members "www" button from post and profile for guest users, because the search engine will leave my site and start indexing the members "www".

Posted: Sat Oct 07, 2006 4:35 pm
by RMcGirr83
Wouldn't it be simpler to just do this?

In viewtopic.php find

Code: Select all

	if ( $poster_id != ANONYMOUS )
	{
		$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id");
	
IN LINE FIND

Code: Select all

if ( $poster_id != ANONYMOUS )
REPLACE WITH

Code: Select all

if ( $userdata['session_logged_in'] )
then if the user isn't signed in they won't see the images for buttons on the bottom.

Posted: Sat Oct 07, 2006 5:23 pm
by Sassy
wow that worked!

Thank you all for helping me with this subject.

I do have one more request, how would i be able to remove the "www" link in the profile?

I just want to remove the www link and not block the whole profile it self.
Is there a simple way to do this?

Posted: Sat Oct 07, 2006 5:40 pm
by RMcGirr83
Remove it as in get rid of it...or remove it as in hiding it from all eyes...or removing as in using it for something else...or.....? lol

Posted: Sat Oct 07, 2006 5:56 pm
by Sassy
Remove as in just hiding from guest users lol

Posted: Sat Oct 07, 2006 5:59 pm
by RMcGirr83
You want to remove the www link or entry in the profile for guest users? Hide it in the viewing of someones profile?

Posted: Sat Oct 07, 2006 6:59 pm
by Sassy
just the www entry

Posted: Sat Oct 07, 2006 7:42 pm
by RMcGirr83
The easiest way is to open your profile_add_body.tpl and remove

Code: Select all

	<tr> 
	  <td class="row1"><span class="gen">{L_WEBSITE}:</span></td>
	  <td class="row2"> 
		<input type="text" class="post" style="width: 200px"  name="website" size="25" maxlength="255" value="{WEBSITE}" />
	  </td>
	</tr>
No one will then be able to enter a website address...then in profile_view_body.tpl

remove

Code: Select all

		<tr> 
		  <td valign="middle" align="right" nowrap="nowrap"><span class="gen">{L_WEBSITE}:&nbsp;</span></td>
		  <td><span class="gen"><b>{WWW}</b></span></td>
		</tr>
to get rid of the www when viewing someones profile

Posted: Sat Oct 07, 2006 7:52 pm
by Sassy
I was hoping there was a easy way to just hide it from guest users, so search engines does not leave my page when indexing.

But since there no easy way of doing it, ill just have to deal with it.
Thanks for your help tho
:)

Posted: Sat Oct 07, 2006 8:10 pm
by RMcGirr83
You can also use

Code: Select all


<!-- BEGIN switch_user_logged_in -->
<!-- END switch_user_logged_in -->

around those sections in those files to hide the entries as well.