[2.0.15] Redirect anonymous users to login

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
102
73%
Very Good
25
18%
Good
3
2%
Fair
1
1%
Poor
8
6%
 
Total votes: 139

User avatar
infarmer
Registered User
Posts: 10
Joined: Sat Jun 12, 2004 6:25 pm

Re: [2.0.15] Redirect anonymous users to login

Post by infarmer » Mon Jul 02, 2007 12:57 am

Well... logically you made a mistake there in profile.php. It is only a couple lines, so you should be able to find your mistake easily.

Code: Select all

if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
	$mode = ( isset($HTTP_GET_VARS['mode']) ) ? $HTTP_GET_VARS['mode'] : $HTTP_POST_VARS['mode'];
   }
if ( $mode == 'viewprofile' )
   {
      if ($userdata['user_id'] == ANONYMOUS)
      {
         redirect(append_sid('login.'.$phpEx));
      }
		
	else if ( $mode == 'editprofile' || $mode == 'register' )
Could you tell me where I made the mistake? Tried different things...didnt save the original file to check with it.This is in profile.php
I dont know where I messed up...it worked well on memberlist.php..but the profile page is messed up...after I log in and try to see profile a blank page comes, same when I try to register without loging in (assuming I am a guest).
I made the changes only on memberlist.php and profile.php

Whitestar
Registered User
Posts: 14
Joined: Sun Jun 03, 2007 5:29 pm

Re: [2.0.15] Redirect anonymous users to login

Post by Whitestar » Mon Jul 02, 2007 1:24 am

Is there a linux version of this mod?

User avatar
Brf
Support Team Member
Support Team Member
Posts: 50805
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by Brf » Mon Jul 02, 2007 2:43 am

infarmer wrote:

Code: Select all

if ( $mode == 'viewprofile' )
   {
      if ($userdata['user_id'] == ANONYMOUS)
      {
         redirect(append_sid('login.'.$phpEx));
      }
		
	else if ( $mode == 'editprofile' || $mode == 'register' )
It looks like you dropped a bunch of code. It should look like this:

Code: Select all

if ( $mode == 'viewprofile' )
	{
		if ($userdata['user_id'] == ANONYMOUS)
		{
			redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=viewprofile&" . POST_USERS_URL . '=' . intval($HTTP_GET_VARS[POST_USERS_URL]), true));
		}

		include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
		exit;
	}
	else if ( $mode == 'editprofile' || $mode == 'register' )

User avatar
Brf
Support Team Member
Support Team Member
Posts: 50805
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by Brf » Mon Jul 02, 2007 2:44 am

Whitestar wrote:Is there a linux version of this mod?
phpBB is written in PHP. The server operating system does not matter.

myabc
Registered User
Posts: 2
Joined: Thu Mar 08, 2007 10:17 am

Re: [2.0.15] Redirect anonymous users to login

Post by myabc » Mon Jul 02, 2007 5:59 am

Author Notes:
## To make this MOD work, the forums must be set to registered users only.
## Go to the "Forum Permissions Control" section and
## set "View", "Read", "Post", etc. to "REG".
Forum admin>permissions>select a forum ?
But I can not find a permission control section that applies to the whole forum :(

Where is it?

User avatar
infarmer
Registered User
Posts: 10
Joined: Sat Jun 12, 2004 6:25 pm

Re: [2.0.15] Redirect anonymous users to login

Post by infarmer » Mon Jul 02, 2007 10:22 am

Thank you so much for fixing my error, everything is working well as I wanted.

Thanks again Brf for your support.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 50805
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by Brf » Mon Jul 02, 2007 11:59 am

myabc wrote: the whole forum
There isnt any "the whole forum". The word "forum" refers to an individual, such as this "Mod Database Releases" forum. The forums are grouped into a category, which are grouped into a board.


You need to set each individual forum to Reg[hidden] to keep guests from viewing.

emmathegreat
Registered User
Posts: 1
Joined: Thu Jun 28, 2007 1:02 am

Re: [2.0.15] Redirect anonymous users to login

Post by emmathegreat » Thu Jul 12, 2007 8:08 am

Okay. I have checked and rechecked to make sure I have installed this mod correctly and I do believe that I have. It works perfectly for everything except for the usergroup section. It gives me this error message:

"Parse error: parse error, unexpected '}' in /hsphere/local/home/queenemm/temptationsoftheflesh.org/phpbb2/groupcp.php on line 200"

I went to line 200 and there is not even a } there so I have no idea what to do now.

If anyone could help me that would be fantastic!

Thank you!

User avatar
Brf
Support Team Member
Support Team Member
Posts: 50805
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by Brf » Thu Jul 12, 2007 12:00 pm

The place to start is on the lines you have editted...

Swamprat
Registered User
Posts: 1
Joined: Thu Aug 02, 2007 9:24 pm

Re: [2.0.15] Redirect anonymous users to login

Post by Swamprat » Tue Aug 07, 2007 3:16 pm

I am new to all this. I have installed a mod or two but I have some questions on this one. I want to keep the nonmembers from seeing the memberlist and profile but want to leave the forums open to them. We dont do the group thing and dont really need that. Can I just close the memberlist and profiles and how do I do it?

Thanks,
John

User avatar
Brf
Support Team Member
Support Team Member
Posts: 50805
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by Brf » Tue Aug 07, 2007 4:09 pm

This mod involves adding code to viewprofile and memberlist, to redirect guests to login. THere is no need to change your forum permissions if you do not want to.

Good Knowledge
Registered User
Posts: 24
Joined: Thu Jan 04, 2007 11:01 pm

Re: [2.0.15] Redirect anonymous users to login

Post by Good Knowledge » Sun Aug 12, 2007 4:16 pm

I can only download this thing as a movie file? what the double heck??

Can someone email me the source

Thanks in advance,

mark@mrprotein.com

diabolic.bg
Registered User
Posts: 447
Joined: Mon Dec 11, 2006 3:41 pm
Location: Bulgaria, Sofia
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by diabolic.bg » Sun Aug 12, 2007 4:50 pm

Good Knowledge wrote:I can only download this thing as a movie file? what the double heck??

Can someone email me the source

Thanks in advance,

mark@mrprotein.com
Open the "movie file" with text editor like a notepad and you will see the source. Save as filename_txt.

Good Knowledge
Registered User
Posts: 24
Joined: Thu Jan 04, 2007 11:01 pm

Re: [2.0.15] Redirect anonymous users to login

Post by Good Knowledge » Sun Aug 12, 2007 5:23 pm

diabolic.bg wrote: Open the "movie file" with text editor like a notepad and you will see the source. Save as filename_txt.

Ok got it but I'm still a little lost. I just want to add this to my members list page but I'm unsure where to insert it into memberlist.php?

Thanks in advance again,

Mark

diabolic.bg
Registered User
Posts: 447
Joined: Mon Dec 11, 2006 3:41 pm
Location: Bulgaria, Sofia
Contact:

Re: [2.0.15] Redirect anonymous users to login

Post by diabolic.bg » Mon Aug 13, 2007 8:23 am

Code: Select all

#-----[ OPEN ]---------------------------------------------
#
memberlist.php

#
#-----[ FIND ]---------------------------------------------
#
init_userprefs($userdata);

#
#-----[ AFTER, ADD ]---------------------------------------------
#
if ($userdata['user_id'] == ANONYMOUS)
{
	redirect(append_sid("login.$phpEx?redirect=memberlist.$phpEx", true));
}

#

Post Reply

Return to “[2.0.x] MOD Database Cleanup”

Who is online

Users browsing this forum: No registered users and 5 guests