Back to vBulletin Tips & Tricks

description for meta and bookmarksite on showthread
by Zachariah 18 Mar 2009
Rating: (1 vote - 5.00 average)

Hello,
I took on a task to make bookmarksite operate with a few more features and ended up also creating data for meta description. The code needs some optimization, but you will get the idea.

The point was to get "pagetext" data from the 1st post in the thread to display on showthread.php.

In file includes\function.php, find function: " fetch_threadinfo"

FIND:
PHP Code:
SELECT IF(visible 210) AS isdeleted
REPLACE WITH:
PHP Code:
SELECT IF(thread.visible 210) AS isdeleted
ABOVE:
PHP Code:
thread.* 
Add:
PHP Code:
" . iif($vbulletin->options['threadpreview'] > 0 AND THIS_SCRIPT == 'showthread', 'post.pagetext AS preview, ') . " 
ABOVE:
PHP Code:
$tachyjoin 
Add:
PHP Code:
" . iif($vbulletin->options['threadpreview'] > 0 AND THIS_SCRIPT == 'showthread', "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid thread.firstpostid)") . " 
BELOW:
PHP Code:
WHERE thread.threadid $threadid 
        
"); 
Add:
PHP Code:
if($vbulletin->options['threadpreview'] > AND THIS_SCRIPT == 'showthread'
    { 
    
$threadcache["$threadid"]['preview'] = strip_quotes($threadcache["$threadid"]['preview']);
    
$threadcache["$threadid"]['preview'] = preg_replace ('/\n(\s*)/'" "$threadcache["$threadid"]['preview']);
    
$threadcache["$threadid"]['preview'] = preg_replace ('/\r(\s*)/'" "$threadcache["$threadid"]['preview']);
    
$threadcache["$threadid"]['preview'] = str_replace("  "" "$threadcache["$threadid"]['preview']);
    
$threadcache["$threadid"]['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($threadcache["$threadid"]['preview'], falsetrue), $vbulletin->options['threadpreview'])));

This will create $threadinfo['preview'] within showthread.php.
- This value can be added to the meta tag description in the $headerinclude to give each thread something other than $thread['title'].

We can also edit showthread.php

Find:
PHP Code:
        $bookmarksite['link'] = str_replace(
            array(
'{URL}''{TITLE}'),
            array(
urlencode($vbulletin->options['bburl'] . '/showthread.php?t=' $thread['threadid']), urlencode($thread['title'])),
            
$bookmarksite['url']
        ); 
Replace:
PHP Code:
        $bookmarksite['link'] = str_replace(
            array(
'{URL}''{TITLE}''{DESCRIPTION}'),
            array(
urlencode($vbulletin->options['bburl'] . '/showthread.php?t=' $thread['threadid']), urlencode($thread['title']), urlencode($thread['preview'])),
            
$bookmarksite['url']); 
This will allow {DESCRIPTION} to be added to be added to submitting bookmark URL's to fill out the textarea on submission vs. copy and paste.

EX: Digg
Code:
http://digg.com/submit?phase=2&url={URL}&title={TITLE}&bodytext={DESCRIPTION}

vblts.ru supports vBulletin®, 2022-2024