Previous Thread
Next Thread
Print Thread
Rate Thread
[7.3+] Enable Guests to View All Posts By A User #320609
09/22/2014 7:05 AM
09/22/2014 7:05 AM
Joined: Jul 2001
Posts: 1,170
California
isaac Offline OP
$coffee=code(true);
isaac  Offline OP
$coffee=code(true);
Joined: Jul 2001
Posts: 1,170
California
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.

Sponsored Links
Re: [7.3+] Enable Guests to View All Posts By A User [Re: isaac] #320610
09/22/2014 7:21 AM
09/22/2014 7:21 AM
Joined: Jan 2000
Posts: 5,938
Portland, OR, USA
Gizmo Offline

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Offline

UBB.Dev / UBB.Wiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,938
Portland, OR, USA
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, UBB.Sitemaps

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
· Blue Host
· Interserver.net
Visit Us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,170
Joined: July 2001
Show All Member Profiles 
Forum Statistics
Forums64
Topics37,448
Posts293,484
Members13,793
Most Online1,498
Mar 17th, 2017
Top Posters(All Time)
AllenAyres 25,587
JoshPet 11,330
Rick 8,373
LK 7,396
Lord Dexter 6,503
Gizmo 5,938
Greg Hard 5,533
Top Posters(30 Days)
isaac 4
Today's Statistics
Currently Online 660
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 17
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2018 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 7.6.2
(Preview build 20180611.dev)
Page Time: 0.040s Queries: 15 (0.017s) Memory: 3.2264 MB (Peak: 3.3471 MB) Zlib enabled. Server Time: 2018-06-18 11:37:08 UTC