Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jul 2001
Posts: 1,157
Likes: 82
coffee and code
coffee and code
Joined: Jul 2001
Posts: 1,157
Likes: 82
Enable Guests to View All Posts By A User

About:
This FIX/MOD enables Guests (unregistered users) to view all posts that a Registered User has made.

As of UBBT 7.3, if you're a Guest (unregistered user) and you clicked on "View Posts" next to a Registered User's name within the PostList, their MemberProfile, the WhosOnline list, or anywhere else within UBBT, the Guest would be presented with a, "FATAL_NOT_LOGGED" error ("You must be logged in to access this page!") - which is somewhat correct, but...

If you toggled this feature "ON" in the script, Guests would be presented with, "We encountered a problem. The reason reported was: Database error only visible to forum administrators." Admins and other registered users never saw this message, but it did appear in the logs.

This fix corrects that error and allows you to toggle the feature on or off from within the userposts.inc.php script.

This fix applies to all versions of UBBT 7.3 through the current UBBT 7.5.8.


There are two parts to this;

Part 1 is the toggling of the feature from OFF, to ON.
By default, the feature is set so that Guests (unregistered users) cannot view all posts by an individual Registered User.

Part 2 is fixing a bug that was introduced in UBBT 7.3 (released in May 2008) and it still exists today, in UBBT 7.5.8.



PART 1, "The Toggle."
In scripts/userposts.inc.php
Find:

Code
"regonly" => 1,

Replace with:
Code
"regonly" => 0,

UBBT DEFAULT IS: 1
To enable enable Guests to view all posts by a Registered User, change this to "0" as shown above.


PART 2, "The Bug Fix."
In scripts/userposts.inc.php
Find:

Code
 	if (!$page || $page < 1) $page = 1;
$PostsPer = array_get($user, 'USER_TOPICS_PER_PAGE', $config['TOPICS_PER_PAGE']);

Replace with:
Code
 	if (!$page || $page < 1) $page = 1;
if($user["USER_TOPICS_PER_PAGE"] == null) { $user["USER_TOPICS_PER_PAGE"] = $config['TOPICS_PER_PAGE']; }
$PostsPer = array_get($user, 'USER_TOPICS_PER_PAGE', $config['TOPICS_PER_PAGE']);

Done!

Hat tip to Giz for the elegant single-line resolution.


Current developer of UBB.threads PHP Forum Software
Current Release: UBBT 7.7.5 // Preview: UBBT 8.0.0
isaac @ id242.com // my forum @ CelicaHobby.com
Sponsored Links
Joined: Jan 2000
Posts: 5,833
Likes: 20
UBBDev / UBBWiki Owner
Time Lord
UBBDev / UBBWiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,833
Likes: 20
That check appears to have been written by a genius; or quite simply, a very slept ninja ;-)


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, My UBB Scripts

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
Posts: 70
Joined: January 2007
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 20221218)