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);
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.
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?
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.
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.
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.
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.
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
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.