Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)

Reply
 
Thread Tools Display Modes
  #1  
Old 10-13-2005, 11:45 PM
ggiersdorf ggiersdorf is offline
 
Join Date: Aug 2005
Posts: 251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 10-14-2005, 12:04 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 10-14-2005, 12:18 PM
ggiersdorf ggiersdorf is offline
 
Join Date: Aug 2005
Posts: 251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #4  
Old 10-14-2005, 12:30 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #5  
Old 10-14-2005, 12:35 PM
ggiersdorf ggiersdorf is offline
 
Join Date: Aug 2005
Posts: 251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 10-14-2005, 12:43 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #7  
Old 10-14-2005, 12:48 PM
ggiersdorf ggiersdorf is offline
 
Join Date: Aug 2005
Posts: 251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 10-14-2005, 12:56 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 10-14-2005, 12:56 PM
ggiersdorf ggiersdorf is offline
 
Join Date: Aug 2005
Posts: 251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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..
Reply With Quote
  #10  
Old 06-01-2006, 12:31 PM
RMSimard RMSimard is offline
 
Join Date: May 2006
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:43 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04554 seconds
  • Memory Usage 2,274KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_php
  • (8)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete