Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons

Reply
 
Thread Tools
[AJAX] Drop Down Message Display / Selector Details »»
[AJAX] Drop Down Message Display / Selector
Version: 1.0.1, by harmor19 harmor19 is offline
Developer Last Online: May 2023 Show Printable Version Email this Page

Category: Mini Mods - Version: 3.6.0 Rating:
Released: 08-25-2006 Last Update: 08-26-2006 Installs: 21
DB Changes Uses Plugins Template Edits
Additional Files  
No support by the author.

File Edits: 0
Template Edits: 2
Difficulty: Easy

Description
This hack adds a drop down menu underneath your navbar.
When someone selects an option it'll load a table with the contents you put in it (without reloading the page).

You can use HTML when you add a new message.

I have added a new hook for the use of replacing text.
I have hardcoded two replacements.

[username] - This will display the username of the user browsing
[userid] - This will display the userid of the user browsing.


F.A.Q.
Q: How can I add my own replacements?
A: Add a new plugin under the hook "ajax_drop_menu_start".
In the Plugin PHP code use this format: $cm['text'] = str_replace("find", "replace", $cm['text']);

Example:
PHP Code:
$cm['text'] = str_replace("[username]"$vbulletin->userinfo['username'], $cm['text']); 
Q: Can I use the hook for other things besides replacing text?
A: Yes. You can use it for almost anything. If you'd like to query the database for the lastest 5 threads and display them in the drop down menu you can.


On the demo you'll see a drop down menu with the text "Select Message".
View The Demo

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 08-26-2006, 04:17 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Examples of what you can do with the plugin are listed below.
Add the code to the hook "ajax_drop_menu_start"


Example 1
You can have the latest 5 threads from a specific forum
PHP Code:
$getthreads $db->query_read("SELECT * FROM " TABLE_PREFIX "thread WHERE forumid='5' ORDER BY threadid DESC LIMIT 5");    
while(
$lt $db->fetch_array($getthreads))
{
   
$latestthreads .= "Title: <a href='showthread.php?t=$lt[threadid]'>".$lt['title']."</a> | Posted By: <a href='member.php?u=$lt[postuserid]'>".$lt['lastposter']."</a><br />";

}

$cm['text'] = str_replace("[latestthreads]"$latestthreads$cm['text']); 
When you create a new message you can now use [latestthreads] to populate the lastest 5 threads posted in forumid 5.


Example 2
This will display the top five users with the highest post count
PHP Code:
$gettopusers $db->query_read("SELECT * FROM " TABLE_PREFIX "user ORDER BY posts DESC LIMIT 5");    
while(
$gtu $db->fetch_array($gettopusers))
{
   
$topusers.= "<a href='member.php?u=$gtu[userid]'>".$gtu['username']."</a>: $gtu[posts]<br />";

}

$cm['text'] = str_replace("[topusers]"$topusers$cm['text']); 
When you create a new message you can now use [topusers] to populate the results


Example 3
This will display the latest 5 threads in every forum the user can access
PHP Code:
$count 0;
$getposts $db->query_read(
    SELECT DISTINCT thread.title AS title, thread.threadid AS threadid, forum.forumid AS forumid
    FROM " 
TABLE_PREFIX "post AS post 
    LEFT JOIN " 
TABLE_PREFIX "thread AS thread 
    ON post.threadid = thread.threadid
    LEFT JOIN " 
TABLE_PREFIX "forum AS forum
    ON thread.forumid = forum.forumid
    ORDER BY postid DESC"
);     
    while(
$post $db->fetch_array($getposts)) 
    { 
          
        
$forumperms fetch_permissions($post['forumid']); 
        if ((
$forumperms $vbulletin->bf_ugp_forumpermissions['canview']) OR ($forumperms $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) 
        { 
            if(
$count <= 5
            { 
                
$latestthreads2 .= "<b>Title</b>: <a href='showthread.php?t=$post[threadid]'>".$post['title']."</a><br />"
         
            } 
             
        
$count++; 
         
        } 
    } 

$cm['text'] = str_replace("[latestthreads_2]"$latestthreads2$cm['text']); 
Use [latestthreads_2] to populate the results
Reply With Quote
  #3  
Old 08-26-2006, 05:22 AM
therocks therocks is offline
 
Join Date: Mar 2006
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

great mod!! ... would there be a way to pull 5 or 10 of the latest threads from a specific forum into one of those boxes????
Reply With Quote
  #4  
Old 08-26-2006, 05:27 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by therocks
great mod!! ... would there be a way to pull 5 or 10 of the latest threads from a specific forum into one of those boxes????
No. I'll try and improve upon this hack in the next release though.
Reply With Quote
  #5  
Old 08-26-2006, 05:29 AM
therocks therocks is offline
 
Join Date: Mar 2006
Posts: 19
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by harmor19
No. I'll try and improve upon this hack in the next release though.
thanks
Reply With Quote
  #6  
Old 08-26-2006, 05:54 AM
Kirk Y's Avatar
Kirk Y Kirk Y is offline
 
Join Date: Apr 2005
Location: Tallahassee, Florida
Posts: 2,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Interesting idea. What would be the ideal use for this?
Reply With Quote
  #7  
Old 08-26-2006, 06:02 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by acidburn0520
Interesting idea. What would be the ideal use for this?
I guess if you had a clan site you could list the users in each clan.
Reply With Quote
  #8  
Old 08-26-2006, 07:06 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've updated my hack. I hope you like it.
Reply With Quote
  #9  
Old 08-26-2006, 07:13 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by therocks
great mod!! ... would there be a way to pull 5 or 10 of the latest threads from a specific forum into one of those boxes????
You can do this on version 1.0.1 now.

If you need help coding the query I can assist you.
Reply With Quote
  #10  
Old 08-26-2006, 07:32 AM
harmor19 harmor19 is offline
 
Join Date: Apr 2005
Posts: 1,324
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am using the first post to post examples. What other examples would you like to see posted?
Reply With Quote
Reply

Thread Tools

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 06:25 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.04470 seconds
  • Memory Usage 2,315KB
  • Queries Executed 23 (?)
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
  • (4)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)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