Previous Thread
Next Thread
Print Thread
Rate Thread
[7.3+] Enable Guests to View All Posts By A User #320609
09/22/2014 6:05 AM
09/22/2014 6:05 AM
Joined: Jul 2001
Posts: 1,208
California
isaac Online happy OP
$coffee=code(true);
isaac  Online Happy OP
$coffee=code(true);

Joined: Jul 2001
Posts: 1,208
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 6:21 AM
09/22/2014 6:21 AM
Joined: Jan 2000
Posts: 5,947
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,947
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
Bill B
Bill B
Issaquah, WA
Posts: 84
Joined: December 2001
Show All Member Profiles 
Forum Statistics
Forums64
Topics37,467
Posts293,523
Members13,802
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,947
Greg Hard 5,533
Top Posters(30 Days)
isaac 1
Today's Statistics
Currently Online 748
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 15
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2018 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 7.7.0
(Snapshot build 20181115.dev)
PHP: 5.4.45 Page Time: 0.029s Queries: 15 (0.011s) Memory: 3.1641 MB (Peak: 3.4060 MB) Data Comp: Zlib Server Time: 2018-12-15 15:42:35 UTC