vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Alphabetic Subforum Sorting Request. (https://vborg.vbsupport.ru/showthread.php?t=98356)

ggiersdorf 10-13-2005 11:45 PM

Alphabetic Subforum Sorting Request.
 
I currently run a Video Game Websit forum and have many subforums dedicated to individual games for organization purposes. I used this mod here to help clear up the subforums
https://vborg.vbsupport.ru/showthrea...187#post795187

Which works great BTW, but I need a plugin that will sort Subforums Alphabetically. Im sure MANY users would love to have this, as adding new forums would than be easy to find as Its a pian to reorganize them each time I add a new forum..

Please help might even be a Hack of the Month! :)

Thanks in advance

Andreas 10-14-2005 12:04 AM

Simple, but not efficient --- not recommended for larger forums

cache_ordered_forums
PHP Code:

$forumcheck end($vbulletin->forumcache);
if (!
$forumcheck['sorted'])
{
    function 
forumsort($forum1$forum2)
    {
        return 
strnatcasecmp($forum1['title_clean'], $forum2['title_clean']);
    }
    
uasort($vbulletin->forumcache'forumsort');
    
$lastforum end($vbulletin->forumcache);
    
$vbulletin->forumcache["$lastforum[forumid]"]['sorted'] = 1;
    
build_datastore('forumcache'serialize($vbulletin->forumcache));


Edit: Code optimized, should not cause any serious overhead any longer :)
Still not recommended to be used in a productive environment though.

ggiersdorf 10-14-2005 12:18 PM

IS this something you can work on Kirby? I think it would be a GREAT feature, and what do you consider a large forum? I can possibly have 500 subforum in different sections.

also where in cache_ordered_forums would this go anywhere?

and what weight should the subforum be set at all 1?

and will there be more modifications to this so we can use in a an actually environment?

Andreas 10-14-2005 12:30 PM

Quote:

Originally Posted by ggiersdorf
IS this something you can work on Kirby?

I don't understand this question

Quote:

what do you consider a large forum?
More than 50 Forums, avg. online users > 100.

Quote:

also where in cache_ordered_forums would this go anywhere?
I don't understand this question. This is a Plugin.

Quote:

and what weight should the subforum be set at all 1?
Doesn't matter; it sorts all Forums.

Quote:

and will there be more modifications to this so we can use in a an actually environment?
I don't understand this question.

ggiersdorf 10-14-2005 12:35 PM

Sorry Kirby, Im new to this sorry let me try again.

Quote:

cache_ordered_forums

PHP Code:
$forumcheck = end($vbulletin->forumcache);
if (!$forumcheck['sorted'])
{
function forumsort($forum1, $forum2)
{
return strnatcasecmp($forum1['title_clean'], $forum2['title_clean']);
}
uasort($vbulletin->forumcache, 'forumsort');
$lastforum = end($vbulletin->forumcache);
$vbulletin->forumcache["$lastforum[forumid]"]['sorted'] = 1;
build_datastore('forumcache', serialize($vbulletin->forumcache));
}
First off you say its a plugin? do I need to make it a plug-in? if so how, where

3.5 is my first Vbulletin experience.


Secondly, I can potentially have under each section about 150-200 forums per game, right now I have basically 25 users so not a problem there it's a start.

Thirdly you said do not use in a production environment. So is it possible to make it so we can use it in larger forums, with more users and have it be stable and fast?

Thanks again in advance Kirby.

Andreas 10-14-2005 12:43 PM

ACP / Plugin System / Add new Plugin
Product = vBulletin
Hook Location = cache_ordered_forums
Title = Alphabetically ordered Forums (or foobar or whocares or ...)
Plugin PHP Code = the Code I posted
Plugin is Active = Yes

That's it

Quote:

So is it possible to make it so we can use it in larger forums, with more users and have it be stable and fast?
You can use it with any size forum; I am not aware of bugs and it should not cause any serious overhead.
Though, I don't give any support - it could possibly blow up your whole forum, therefore strongly not recommended to be used in production environment :)

ggiersdorf 10-14-2005 12:48 PM

WOW worked like a charm and noticed no speed issues, though I did notice the forum Categories etc, have sorted alphabetically also. will work on this and see how to fix it.

Any way to make just the subforms alphabetic?


Thanks if you can think of anything else please let me know..

Kirby da coder. :)

Andreas 10-14-2005 12:56 PM

Quote:

Any way to make just the subforms alphabetic?
Code:

Forum 1
+ Forum 1.1
  + Forum 1.1.1
      + Forum 1.1.1.1
Forum 2
+ Forum 2.1
Forum 3

What are Subforums in this layout?

Is would be (a lot) more difficult, but should still be doable ... somehow.

ggiersdorf 10-14-2005 12:56 PM

Kirby let me ask this any way to specify which forums this will do this for? Like one or two specific subsections? Instead of the entire forum??

I sent you a PM with some info. thanks

Kirby I had an Idea might be able to make this easier.

Is there a way to make your code work with only forums with a specific display order?

Let say if we make a display order 99 all forums except 99 will stay in there respective places, but anyhting with 99 would than be sorted with your code?!

Hope that can be done..

RMSimard 06-01-2006 12:31 PM

Old thread, I know. I've updated Andreas' plugin to account for forum display order as well as alphabetical ordering:

PHP Code:

$forumcheck end($vbulletin->forumcache);
if (!
$forumcheck['sorted'])
{
    function 
forumsort($forum1$forum2)
    {
        if (
$forum1['displayorder'] == $forum2['displayorder'])
        {
            return 
strnatcasecmp($forum1['title_clean'], $forum2['title_clean']);
        }
        return (
$forum1['displayorder'] < $forum2['displayorder'])
        ?    -
1
        
:    1;
    }
    
uasort($vbulletin->forumcache'forumsort');
    
$lastforum end($vbulletin->forumcache);
    
$vbulletin->forumcache["$lastforum[forumid]"]['sorted'] = 1;
    
build_datastore('forumcache'serialize($vbulletin->forumcache));


Works on my 350+ subforums. I only wish vB could leave the database do this simple job. Enjoy!


All times are GMT. The time now is 01:33 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01099 seconds
  • Memory Usage 1,766KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (2)bbcode_php_printable
  • (8)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete