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,186
California
isaac Online happy OP
$coffee=code(true);
isaac  Online Happy OP
$coffee=code(true);

Joined: Jul 2001
Posts: 1,186
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.


isaac @ id242.com // my forum @ CelicaHobby.com
a current developer of UBB.threads php forum software // 7.6.x Progress Reports
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,941
Portland, OR, USA
Gizmo Online tapedshut

UBB.Dev / UBB.Wiki Owner
Time Lord
Gizmo  Online Tapedshut

UBB.Dev / UBB.Wiki Owner
Time Lord

Joined: Jan 2000
Posts: 5,941
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.SitemapsJames Corthell

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
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,941
Joined: January 2000
Show All Member Profiles 
Forum Statistics
Forums64
Topics37,456
Posts293,497
Members13,800
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,941
Greg Hard 5,533
Top Posters(30 Days)
isaac 8
Gizmo 3
driv 1
Today's Statistics
Currently Online 872
Topics Created 2
Posts Made 6
Users Online 4
Birthdays 23
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2018 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 7.6.3
(Snapshot build 20180923.dev)
PHP: 5.4.45 DB: MySQLi Page Time: 0.119s Queries: 15 (0.008s) Memory: 3.2413 MB (Peak: 3.4828 MB) Zlib enabled. Server Time: 2018-09-24 05:21:55 UTC