Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x
Author Message
derek765
Regular
Regular



Joined: Sep 27, 2012
Posts: 99
Location: Okinawa, Japan

PostPosted: Thu Dec 06, 2012 4:08 am Reply with quote

How could I go about restricting profile viewing of registered users for guests?

Currently when I am logged out of my admin account and registered user account and go to these both, I am able to view any registered users profile as a guest.

/modules.php?name=Forums&file=profile&mode=viewprofile&u=USER#
/modules.php?name=Your_Account&op=userinfo&username=USERNAME
 
View user's profile Send private message Visit poster's website
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1772

PostPosted: Thu Dec 06, 2012 9:43 am Reply with quote

To hide the userinfo pages, you can try this:

Open modules/your_Account/public/userinfo.php

find:

Code:
if (!isset($bypass)) $bypass = '';


after add:

Code:
if (is_user($user) || is_admin($admin)) {


find:

Code:
include_once 'footer.php';


after add:

Code:
} else {

   Header('Location: ./');
   exit();
}



To hide the forum profile pages, you can try this:

Open modules/Forums/includes/usercp_viewprofile.php

find:

Code:
if ( !defined('IN_PHPBB') )

{
   die("Hacking attempt");
   exit;
}


after add:

Code:
if (is_user($user) || is_admin($admin)) {


find:

Code:
include("modules/Forums/includes/page_tail.php");


after add:

Code:
} else {

   Header('Location: ./');
   exit();
}

_________________
Github: RavenNuke 
View user's profile Send private message
derek765







PostPosted: Thu Dec 06, 2012 3:50 pm Reply with quote

Awesome that works, now I noticed that the code redirects the user back to the index.

Now what could I use to just keep the guest on the same page and give them a notification that they need to be registered before trying to view someones profile?
 
neralex







PostPosted: Thu Dec 06, 2012 4:26 pm Reply with quote

Open your modified modules/your_Account/public/userinfo.php

find:

Code:
} else {

   Header('Location: ./');
   exit();
}


replace it with:

Code:
} else {

   include_once 'header.php';
   OpenTable();
   echo '<div class="text-center">[ <a href="javascript:history.go(-1)">Go back</a> ]</div>';
   CloseTable();
   include_once 'footer.php';
}


Open your modified modules/Forums/includes/usercp_viewprofile.php

find:

Code:
} else {

   Header('Location: ./');
   exit();
}


replace it with:

Code:
} else {

   echo '<div class="text-center">[ <a href="javascript:history.go(-1)">Go back</a> ]</div>';
   // Note: In my theme i must remove the closing div to get a valid result. Check this with your theme!
   include("modules/Forums/includes/page_tail.php");
}
 
derek765







PostPosted: Thu Dec 06, 2012 4:40 pm Reply with quote

This is now what I get when I view someones profile via Your Account as guest, this looks great and is just how I wanted it.

Image

But when I view someones profile via Forums as guest, this is what I get and I think this is what your talking about with having to comment out the </div> in your themes?

I would like this one to have that same table and looks as when viewing profile via Your Account.

Image
 
neralex







PostPosted: Thu Dec 06, 2012 4:58 pm Reply with quote

I just wanted to clarify the way for the function. You can determine self the description of the link. You can use a existing language constant or you create a new one in the language files. With the closing div i have meaned a validation error. I'm using only self written themes and I got the validation error in my own themes in the forum profile view. If you have added the new lines, please check it with a validator and/or replace it with your own code/styles.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©