mod to prevent non-registered people to view profile

This forum is now closed as part of retiring phpBB2.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
Daren
Registered User
Posts: 59
Joined: Sun May 12, 2002 3:24 pm
Location: In front of my computer - Singapore!
Contact:

mod to prevent non-registered people to view profile

Post by Daren » Sat Oct 12, 2002 2:30 am

Hi people...

there is a mod now that prevents unregistered/not logged in people to see the memberlist.php and groupcp.php

I was thinking to make it full fledge we must prevent people to view the profile of the user entirely, because under every post there is the buttons to see profile, email, icq etc... and the file to edit is viewtopic.php

my idea is to check session to see if user is logged in.. and if he is not, just don't display the buttons...

i found the looping sequence that generate the post.. but i do not know where to start to add the code to prevent the buttons from appearing..
i was thinking is it under the section whereby there is a if statement checking for annoymous poster?

please advice :)
this is pretty new for me.. so need some help

TIA! :wink:

DJ P@CkMaN
Registered User
Posts: 194
Joined: Thu Jun 06, 2002 12:55 am
Location: Brisbane, Australia
Contact:

Post by DJ P@CkMaN » Sat Oct 12, 2002 2:49 am

This is a quick guess as I'm busy so don't shoot me if I am wrong :wink: but I think this will do the job. You will need to find the code I edited.

Note: I added the elseif part

Code: Select all

	if ( $poster_id != ANONYMOUS )
	{
		$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id");
		$profile_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" /></a>';
		$profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>';

		$temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=$poster_id");
		$pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>';
		$pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>';

		if ( !empty($postrow[$i]['user_viewemail']) || $is_auth['auth_mod'] )
		{
			$email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $poster_id) : 'mailto:' . $postrow[$i]['user_email'];

			$email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>';
			$email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>';
		}
		else
		{
			$email_img = '';
			$email = '';
		}

		$www_img = ( $postrow[$i]['user_website'] ) ? '<a href="' . $postrow[$i]['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : '';
		$www = ( $postrow[$i]['user_website'] ) ? '<a href="' . $postrow[$i]['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : '';

		if ( !empty($postrow[$i]['user_icq']) )
		{
			$icq_status_img = '<a href="http://wwp.icq.com/' . $postrow[$i]['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $postrow[$i]['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>';
			$icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $postrow[$i]['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>';
			$icq =  '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $postrow[$i]['user_icq'] . '">' . $lang['ICQ'] . '</a>';
		}
		else
		{
			$icq_status_img = '';
			$icq_img = '';
			$icq = '';
		}

		$aim_img = ( $postrow[$i]['user_aim'] ) ? '<a href="aim:goim?screenname=' . $postrow[$i]['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : '';
		$aim = ( $postrow[$i]['user_aim'] ) ? '<a href="aim:goim?screenname=' . $postrow[$i]['user_aim'] . '&message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : '';

		$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id");
		$msn_img = ( $postrow[$i]['user_msnm'] ) ? '<a href="' . $temp_url . '"><img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '" title="' . $lang['MSNM'] . '" border="0" /></a>' : '';
		$msn = ( $postrow[$i]['user_msnm'] ) ? '<a href="' . $temp_url . '">' . $lang['MSNM'] . '</a>' : '';

		$yim_img = ( $postrow[$i]['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $postrow[$i]['user_yim'] . '&.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : '';
		$yim = ( $postrow[$i]['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $postrow[$i]['user_yim'] . '&.src=pg">' . $lang['YIM'] . '</a>' : '';
	}
	elseif ( !$userdata['session_logged_in'] )
	{
		$profile_img = '';
		$profile = '';
		$pm_img = '';
		$pm = '';
		$email_img = '';
		$email = '';
		$www_img = '';
		$www = '';
		$icq_status_img = '';
		$icq_img = '';
		$icq = '';
		$aim_img = '';
		$aim = '';
		$msn_img = '';
		$msn = '';
		$yim_img = '';
		$yim = '';
	}
	else
	{
		$profile_img = '';
		$profile = '';
		$pm_img = '';
		$pm = '';
		$email_img = '';
		$email = '';
		$www_img = '';
		$www = '';
		$icq_status_img = '';
		$icq_img = '';
		$icq = '';
		$aim_img = '';
		$aim = '';
		$msn_img = '';
		$msn = '';
		$yim_img = '';
		$yim = '';
	}

issue9mm
Registered User
Posts: 22
Joined: Mon Dec 24, 2001 5:11 am

Post by issue9mm » Sat Oct 12, 2002 9:51 pm

Hiding the profile information in the bottom of each post is not going to hide the information from anyone should they type the URL into their browser directly.

As for hiding the profile information and whatnot, it shouldn't be too difficult at all. In the template, just hide the information you don't want to be shown between <!-- BEGIN switch_user_logged_in --> and <!-- END switch_user_logged_in --> tags, and for the <!-- BEGIN switch_user_logged_out --> and <!-- END switch_user_logged_out --> tags, just put "You must be logged in to view this page", or whatever you like.

All the work can be done in the templates anyway, without having to modify any of the php code whatsoever. Take advantage of what's there.

-9mm-

netclectic
Former Team Member
Posts: 4439
Joined: Wed Mar 13, 2002 3:08 pm
Location: Omnipresent
Contact:

Post by netclectic » Sat Oct 12, 2002 11:01 pm

This has been done like a gazillion times, search is your friend ;)

http://www.phpbb.com/phpBB/viewtopic.php?t=39923
Defend the game:
Image

Daren
Registered User
Posts: 59
Joined: Sun May 12, 2002 3:24 pm
Location: In front of my computer - Singapore!
Contact:

Post by Daren » Sun Oct 13, 2002 2:19 pm

oh thanks people :)

But frankly.. actualyl till now I don understand the concept of the template.. cos usually i just code them.. but templates?

Post Reply

Return to “[2.0.x] MOD Writers Discussion”