PDA

View Full Version : User Selectable "Maximum Displayed Threads Before Page Split"


Brent H
12-07-2005, 10:00 PM
/*================================================= =====================*\
|| User Selectable "Maximum Displayed Threads Before Page Split"
|| Author : Brent Hegnauer (TheHeggy)
|| Works on : vBulletin 3.5.2
|| Released : Dec 08, 2005
||
|| Time required to install: 2 minutes
|| Difficulty: Easy
\*================================================ ======================*/

Description:

This plugin allows you to give your members control over how many threads are displayed on forumdisplay.php (via the Options page in their UserCP). I saw this requested somewhere on this site and figured I'd give it a shot.

Statistics:

Plugins: 1
Custom Profile Fields: 1

Installation:

1) Create a new Custom Profile Field with the following settings:

/*================================================= =====================*\

Profile Field Type: Single-Selection Radio Buttons

Title: Maximum Displayed Threads

Description: This setting allows you to set how many threads are listed per page.

Options: 20

Set Default: Yes

Display Order: (Doesn't matter!)

Field Required: No

Field Editable By User: Yes

Private Field: No

Field Searchable on Members List: No

Show on Members List: No

Allow user to input their own value for this option: Yes

Max length of allowed user input: 2

Display Size: 2

Regular Expression: [0-9]

Which page displays this option? Options: Thread Viewing

\*================================================ ======================*/

2) Submit and take note of the name of the field it displays... For me it's field5.

3) Upload the plugin.

4) Edit your plugin and change all instances of field5 to whatever yours happens to be.

Done!

It's vital that your field ID be correct, otherwise every forumdisplay.php will return MySQL errors!

Enjoy :) If there's any problems, I'll try to help. No guarantees though, as I manage 4 sites and don't have a lot of extra time. You're free to modify and redistribute this as you see fit.

Updates:

1.0 - Initial Release

1.1 - Added Marco's code to prevent users from breaking the forumdisplay by putting in a "0".

Marco van Herwaarden
12-08-2005, 11:09 AM
I suggest changing:
$vbulletin->options['maxthreads'] = $vbulletin->userinfo['field5'];to:
$vbulletin->options['maxthreads'] = (intval($vbulletin->userinfo['field5']) > 0 ? intval($vbulletin->userinfo['field5']) : $vbulletin->options['maxthreads']);

Brent H
12-08-2005, 11:24 AM
Thanks man! Good idea :)

Snake
12-08-2005, 04:17 PM
Thanks, nice hack!

Brent H
12-08-2005, 08:42 PM
Thanks, Aftermath. Glad you like it!

o1dirtydog
12-08-2005, 10:22 PM
this is nice man... surprised it's not already something vb does by default.

im ganna install this tomorrow

FleaBag
12-12-2005, 11:42 AM
Nice little addition! I shall install! :)

tfw2005
04-19-2006, 08:26 AM
Getting an error with this when clicking the "Thread Starter" "Replies" and "Views" sorting links on the top of the thread display columns.

When i sort by Thread, Rating, or Last Post, it works fine.

Have a ton of other hacks installed, including personal stickies and seperated stickies.

However, the sorting works when this plugin is uninstalled, doesnt when they are uninstalled and this isn't, leads me to believe error is with this.

Anyone else having this issue?



Database error in vBulletin 3.5.4:

Invalid SQL:

SELECT threadid

FROM thread AS thread

WHERE forumid = 299
AND sticky = 0
AND threadid NOT IN (14462,15419)
AND visible IN (0,1,2)




ORDER BY sticky DESC, DESC
LIMIT 0, 10;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC
LIMIT 0, 10' at line 13
Error Number : 1064
Date : Wednesday, April 19th 2006 @ 05:23:11 AM
Script : /forumdisplay.php?f=299&daysprune=-1&order=asc&sort=postusername
Referrer :/forumdisplay.php?f=299
IP Address :
Username :
Classname : vb_database

tfw2005
04-28-2006, 08:56 AM
Anyone else with this issue, or, anyone know of a quick fix? It breaks a core functionality of the site, can't continue using it if it stays like this. Thanks in advance.