Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Collapsable First Post using AJAX (or Last Post!) Details »»
Collapsable First Post using AJAX (or Last Post!)
Version: 1.2.1, by magnus magnus is offline
Developer Last Online: Feb 2012 Show Printable Version Email this Page

Category: Forum Display Enhancements - Version: 3.6.8 Rating:
Released: 04-17-2007 Last Update: 04-26-2007 Installs: 412
Uses Plugins Auto-Templates
Additional Files  
No support by the author.

[hr]-[/hr]
NOTICE: This is for vBulletin v3.6 ONLY. You can find a v3.5 compatible version here.
[hr]-[/hr]
*** Confirmed working on ALL vBulletin 3.6.x versions! ***

[hr]-[/hr]
Keywords: FORUMDISPLAY, search, results, collapse, AJAX, collapsable, first, last, unread, post

Description:
Allows you to expand/collapse the first, last or first unread post of a thread from FORUMDISPLAY and search results without the need to load the entire thread.

Details:
Upon perusing the wonderful deals over at slickdeals.net, I noticed this nifty feature which caught my eye. I found it quite useful as most people have a bad habit of not being very descriptive with their thread titles. This little trick made my browsing experience much more enjoyable, so naturally I had to borrow [read: shamelessly rip] the idea.

Please note that no additional queries are added, unless using the 'First Unread Post' option. Otherwise, the only queries performed are the same as those when a thread is normally viewed.

The magic behind this modification is performed by jQuery: The Write Less, Do More, JavaScript Library.

[hr]-[/hr]
Usage:
Simply click the expand icon [+] in front of the thread title to expand, and the collapse icon [-] to collapse. Rocket science, eh?

[hr]-[/hr]
Installation:
  1. Download and unzip the ajax_first_post.zip archive.
  2. Upload necessary files to their respective locations. (Attention custom style users! Be sure to upload the images to your custom image directory.)
  3. Import the product-ajax_first_post.xml via the Product Manager.
  4. Make any desired configuration changes via AdminCP > vBulletin Options > Collapsable First Post using AJAX
  5. ???
  6. Profit!

Notes:
All template modifications are made automatically. They attach to pretty common text locations, so modified styles shouldn't* be a problem.

However, for those who wish (or need) to perform the edits manually, you can find that information here.

[hr]-[/hr]
Comments:
As with all my hacks, this modification is provided free of charge. However, if you find this product useful and have money burning a hole in your pocket, feel free to make a small donation, I won't mind.. really.

Version History:
  • 1.0.0 - Initial release, here's to hoping...
  • 1.1.0
    • Fixed JavaScript errors when using search.
    • Resolved (known) cross browser compatibility issues.
  • 1.2.0
    • New AdminCP configuration options:
      • Ability to select first or last post to be displayed.
      • Ability to disable on a per forum basis.
      • Option to update thread views when expanded.
      • Option to disable automatic template editing with a single click.
    • Tweaked a couple plugins to prevent unnecessary checking.
    • Properly registers in Who's Online
  • 1.2.1
    • Will no longer show expand icon next to thread redirects.
    • Added ability to display first unread post.
    • Completely revamped the automatic template editing system. Should now be able to make template edits to even the most modified templates as well.
    • Fixed a couple non-breaking typos.
    • Included JavaScript in USERCP_SHELL to allow expand/collapse of subscribed threads.
    • Added a hover title to the expand icon to inform the user what they can expect when clicking it.

[hr]-[/hr]
Tips, Tricks and Modifications:

Currently Known Bugs:
  • None

* Please note that this modification was developed on a forum with a userbase of 1 (myself). I've tested it for basic functionality but I cannot guarantee functionality or behavior on your forum. So, please -- make backups before installing this product!

Show Your Support

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

Comments
  #412  
Old 10-02-2007, 05:14 PM
magnus's Avatar
magnus magnus is offline
 
Join Date: Apr 2002
Location: Miami, FL
Posts: 1,107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BIGman2 View Post
Hi this is superb hack which I really need to have but I have a problem.
I installed it and when I go to the threads and click on the + Nothing happens...
Any suggestions?
I would need a link to your forum in order to tell you exactly what's wrong. But, most likely it's due to the vbpost_ajax.php file not being located in your forumroot.
Reply With Quote
  #413  
Old 10-03-2007, 10:03 AM
BIGman2 BIGman2 is offline
 
Join Date: Sep 2006
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My forum is turned off so it won't help you,
The vbpost_ajax.php is in the forum root...the board located in the main directory not in /forum or something else.
Reply With Quote
  #414  
Old 10-03-2007, 10:23 AM
magnus's Avatar
magnus magnus is offline
 
Join Date: Apr 2002
Location: Miami, FL
Posts: 1,107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by BIGman2 View Post
My forum is turned off so it won't help you,
The vbpost_ajax.php is in the forum root...the board located in the main directory not in /forum or something else.
Well, sadly there's only so much I can do then. Basically, just verify that you can access the following URLs without getting a 404.

http://yoursite/vbpost_ajax.php
http://yoursite/clientscript/jquery.js
http://yoursite/clientscript/vbulletin_vbpost.js

Also, verify that you're using the default vBulletin style.. to rule out any style related issues.
Reply With Quote
  #415  
Old 10-03-2007, 01:10 PM
bandanafz1's Avatar
bandanafz1 bandanafz1 is offline
 
Join Date: May 2007
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great Mod, many thanks... works really slick.

Only problem I have is that I have also added the Who Has Read This Post mod.

If I click the thread title to view the message in full the registers the fact that the message has been read. However with the collapsible thread, this does not register the fact that the messages have been read by the user.

Most of my messages do not contain replies, it is basically a read only board for disseminating information so whilst the collapsible threads are really useful for readers, I as the admin want to see what is getting most interest.

Would it be very easy to incorporate some form of interoperability between the mods? possible switchable for those that hadn't installed the Who Has Read mod.

Many thanks... great work!

Edit> Actually did wonder if setting update read count might help but it unfortunately doesn't, presumable it is the step of open the thread view that initiates the steps to register that the user has read the message.
Reply With Quote
  #416  
Old 10-03-2007, 07:15 PM
magnus's Avatar
magnus magnus is offline
 
Join Date: Apr 2002
Location: Miami, FL
Posts: 1,107
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by bandanafz1 View Post
Great Mod, many thanks... works really slick.

Only problem I have is that I have also added the Who Has Read This Post mod.

If I click the thread title to view the message in full the registers the fact that the message has been read. However with the collapsible thread, this does not register the fact that the messages have been read by the user.

Most of my messages do not contain replies, it is basically a read only board for disseminating information so whilst the collapsible threads are really useful for readers, I as the admin want to see what is getting most interest.

Would it be very easy to incorporate some form of interoperability between the mods? possible switchable for those that hadn't installed the Who Has Read mod.

Many thanks... great work!

Edit> Actually did wonder if setting update read count might help but it unfortunately doesn't, presumable it is the step of open the thread view that initiates the steps to register that the user has read the message.
Keeping in mind that this untested, go ahead and try this.

In vbpost_ajax.php:

FIND
PHP Code:
    //if ($_SERVER['REQUEST_METHOD'] == 'POST' AND
    
if ($vbulletin->GPC['ajax'])
    {
        eval(
'print_output("' fetch_template('vbpost_postbit') . '");');
    }
    else
    {
        eval(
'print_output("' fetch_template('vbpost_postbit') . '");');
    }
}

?> 
Add ABOVE:
PHP Code:
    if ($vbulletin->userinfo['userid'])
    {
        
$time TIMENOW;
        
$ipaddress IPADDRESS;
        
$threadid $threadinfo[threadid];
        
$userid $vbulletin->userinfo['userid'];
        
$db->query_write("
            REPLACE INTO " 
TABLE_PREFIX "whoread
            (userid, threadid, dateline, ipaddress)
            VALUES
            (
$userid$threadid$time, '$ipaddress')
        "
);
    } 
Let me know if that works for you.
Reply With Quote
  #417  
Old 10-03-2007, 07:38 PM
ragtek ragtek is offline
 
Join Date: Mar 2006
Location: austria, croatia
Posts: 1,630
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

in my search the posbit images have no id's so it wount work
Code:
<img id="vbpostimg_" src="images/bgold/buttons/expand.gif" onclick="return vbpost_get()"
Reply With Quote
  #418  
Old 10-03-2007, 08:52 PM
bandanafz1's Avatar
bandanafz1 bandanafz1 is offline
 
Join Date: May 2007
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by magnus View Post
Keeping in mind that this untested, go ahead and try this.

In vbpost_ajax.php:

FIND
PHP Code:
    //if ($_SERVER['REQUEST_METHOD'] == 'POST' AND
    
if ($vbulletin->GPC['ajax'])
    {
        eval(
'print_output("' fetch_template('vbpost_postbit') . '");');
    }
    else
    {
        eval(
'print_output("' fetch_template('vbpost_postbit') . '");');
    }
}

?> 
Add ABOVE:
PHP Code:
    if ($vbulletin->userinfo['userid'])
    {
        
$time TIMENOW;
        
$ipaddress IPADDRESS;
        
$threadid $threadinfo[threadid];
        
$userid $vbulletin->userinfo['userid'];
        
$db->query_write("
            REPLACE INTO " 
TABLE_PREFIX "whoread
            (userid, threadid, dateline, ipaddress)
            VALUES
            (
$userid$threadid$time, '$ipaddress')
        "
);
    } 
Let me know if that works for you.
Many thanks, will try tomorrow when I get time.
Reply With Quote
  #419  
Old 10-04-2007, 12:38 PM
bandanafz1's Avatar
bandanafz1 bandanafz1 is offline
 
Join Date: May 2007
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Magnus,

I have tried your update and yes it now registers the read message against the user.

Many thanks for this, both your mod and the who has read mod are ideal for my board.:up:
Reply With Quote
  #420  
Old 10-17-2007, 04:35 AM
hichew hichew is offline
 
Join Date: Dec 2003
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i tried this on my forum... and it's a mess.... my db server load jump to 1700 !!!
anybody use this mod and optimize the code?

i do like this mod..

my post table is 11 gig
Reply With Quote
  #421  
Old 10-17-2007, 10:05 AM
dbembibre's Avatar
dbembibre dbembibre is offline
 
Join Date: Sep 2004
Location: Madrid (Spain)
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by hichew View Post
i tried this on my forum... and it's a mess.... my db server load jump to 1700 !!!
anybody use this mod and optimize the code?

i do like this mod..

my post table is 11 gig
I have a Big board with more than 1000 constant users and no load issues because this mod not add extra queries
The same query is run whether a user clicks on the thread and views the whole thing, or if they click on the expand icon
Reply With Quote
Reply


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 07:59 AM.


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.05246 seconds
  • Memory Usage 2,343KB
  • Queries Executed 25 (?)
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)bbcode_code
  • (4)bbcode_php
  • (5)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
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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