Previous Thread
Next Thread
Print Thread
Rate Thread
#223014 08/26/2002 11:54 PM
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Mod Name / Version: Profile Restriction 1.0

Description: The allows only registered users to view user profiles. Very simple to install.

Working under: UBB.threads 6.0.x, 6.1

Any pre-requisites: none

Author(s): JoshPet www.ubbdev.com

Credits: My board's users requested this.

Files Altered: showprofile.php, /languages/english/showprofile.php

Database Altered: No.

New Files: None
Attachments
54917-ProfileRestriction1.0.txt (0 Bytes, 62 downloads)

Sponsored Links
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
I believe the instructions for changing showprofile.php should be:

code:
#
# Find this:
#

// -------------------------------------------------------------------------
// If we are allowing the view of pictures, let's see if this person wants to
// see it
$Pictureview = $theme['PictureView'];
if ($theme['PictureView']) {
if ($thisuser['U_PictureView'] == "on") {
$PictureView = $thisuser['U_PictureView'];
}
}

#
# ABOVE it, add this:
#

// Limit access to registered users.
if (!$Username) {
$html -> not_right($ubbt_lang['NO_LOGGED'],$Cat);
}



By the way, if you only add NO_LOGGED to the English language file, wouldn't that cause an error if someone has a different language selected?

In my version of the hack, I didn't bother updating the language file(s), so I used:
code:
$html -> not_right('You must be registered and logged in to perform this function.',$Cat);


Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Thanks.....

I've been trying to be really good with hacks on my board and get members to translate into the languages that they know.... but I haven't done all the additions like that. It's tough to keep up with all the "tweaks" for every language.

Joined: Aug 2002
Posts: 51
Power User
Power User
Offline
Joined: Aug 2002
Posts: 51
works great for me on 6.1b1

thanks

Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
this is pert near the same one I posted in the spam thread, I'll point to here


- Allen wavey
- What Drives You?
Sponsored Links
Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
I finally installed this simple hack, thanks!

Joined: Jun 2002
Posts: 29
User
User
Offline
Joined: Jun 2002
Posts: 29
This works great!
How about the ability to prevent banned members from viewing profiles? Banned members can still log in, so they can still view profiles. Is it possible to prevent them?


-Marty
Club MOTS General Manager
Joined: Jun 2002
Posts: 29
User
User
Offline
Joined: Jun 2002
Posts: 29
Just to add: I created a group on my board called "Banned" where I assign all banned users, besides just banning them. That lets me restrict what forums they can view. A modification to restrict that group from viewing profiles would work as well.


-Marty
Club MOTS General Manager
Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
I did a hack (not published) which extends the bans table with specific privilege restrictions. I was going to include a flag for preventing logging in, but couldn't figure out how the login code works.

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
Dave_L, can't you put that check in the start_page.php and force banned users to log in every visit by forcing their cookie to be set that way?

Here is some simple code which will check any ubbt page for group membership before displaying it.

Make sure the line

code:

$user = $userob -> authenticate(U_Groups);



has the U_Groups in authenticate, if it does not, then add it so you can check their group.

Fine a line that looks like this, which sends the page header

code:

// -------------------------------
// Lets give the start of the page
$html = new html;
$html -> send_header($config['title'],$Cat,0,$user);



right after it, place this and edit the message as you like. Change the XX to your desired group number.

code:

if (strpos($user['U_Groups'],'-XX-') !== false) {
$html -> not_right ("You have been banned from viewing user profiles!",$Cat);
}



This is a generic way to check for group membership on any page. It can be used on pages not in your ubbt directory too, with some slight modifications depending on if the page is checking for the ubbt cookie.

Sponsored Links
Joined: Jun 2002
Posts: 29
User
User
Offline
Joined: Jun 2002
Posts: 29
Thanks a lot, Aglavalin! That worked like a charm!


-Marty
Club MOTS General Manager
Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
I use that check, or one almost like it, in several sections on my site outside of the ubbt directory. It's an easy way to restrict access to member areas, control who can upload a file, or change information on a page, etc.

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
[]Dave_L, can't you put that check in the start_page.php and force banned users to log in every visit by forcing their cookie to be set that way?


What I wanted to do was prevent banned users from logging in, not force them to log in.

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
Hmm, change their password to prevent a login? But then they will be tempted to just make another login... Why can't the banned pain-in-the-necks just go away quietly? LOL


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Bill B
Bill B
Issaquah, WA
Posts: 87
Joined: December 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)