[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 »

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 »

Is there a linux version of this mod?
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53398
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 »

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: 53398
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 »

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 »

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 »

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: 53398
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 »

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 »

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: 53398
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 »

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 »

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: 53398
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 »

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 »

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

Can someone email me the source

Thanks in advance,

[email protected]
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 »

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,

[email protected]
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 »

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 »

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”