vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   New Posting Features - Thread Thumbnails (https://vborg.vbsupport.ru/showthread.php?t=214755)

Leonard 12-10-2009 03:40 AM

Hey guys,

So I had the same problem as some of you where, if you use attachments, only the first thread shows up on forumdisplay and all the other threads mysteriously disappear.

After a bit of digging the culprit was actually in a missing "group by" clause in the SQL statement.

Solution
Edit the plugin "Forum Display - Query"

Change the code to this:

Code:

$dothumbnail = false;
if((THIS_SCRIPT == 'forumdisplay') && ($vbulletin->options['thread_thumbnails_active'] == '1')){
        if ($vbulletin->options['thread_thumbnails_forum_list'] && $vbulletin->options['thread_thumbnails_forum_list'] != "") {
                $forumsallowed = explode(",", $vbulletin->options['thread_thumbnails_forum_list']);
                if (in_array($foruminfo['forumid'], $forumsallowed)){
                        $dothumbnail = true;
                        if($vbulletin->options['thread_thumbnails_thumbnail_source'] == '1'){
                                $hook_query_joins .= "LEFT JOIN " . TABLE_PREFIX . "attachment AS attachment ON (attachment.postid = thread.firstpostid AND attachment.extension IN('jpg', 'gif', 'png', 'jpeg', 'bmp'))";
                                $hook_query_fields .= ", MIN(attachment.attachmentid) AS attachmentid";
                                $hook_query_where .= "GROUP BY thread.threadid";

                        } else {
                                $hook_query_fields .= ", thread.thumbnailurl AS thumbnailurl";
                        }
                }
        }
}

The missing line was
Code:

$hook_query_where .= "GROUP BY thread.threadid";
Working now....

Leo

SoloX 12-10-2009 09:15 AM

search thumbnails only appear on the first page. The rest of the pages are displayed as normal (without thumbs). Is it just me? I have VBSEO installed.

mykkal 12-10-2009 09:34 AM

Quote:

Originally Posted by Leonard (Post 1928141)
Hey guys,

So I had the same problem as some of you where, if you use attachments, only the first thread shows up on forumdisplay and all the other threads mysteriously disappear.

After a bit of digging the culprit was actually in a missing "group by" clause in the SQL statement.

Working now....

Leo

hey thanks... haven't tried it yet but I hope it will work. Hopefully the mod maker will release a patched version as well to make it easy on the non-technical folks.

phkk 12-10-2009 01:45 PM

$threadactiontime = (($feed['threadactiondelay'] > 0) ? (TIMENOW + $feed['threadactiondelay'] * 3600) : 0);

preg_match($pat,$pagetext,$matches);
$thumburl = escape_string($matches[1]);
$itemdata->set('thumbnailurl', $thumburl);

phkk 12-10-2009 02:56 PM

PHP Code:

if ($type == 'thread')
            {
                if(
$vbulletin->options['thread_thumbnails_thumbnail_source'] == '0')
                {
                    
$dataman->setr('thumbnailurl'htmlspecialchars_uni($post['thumbnailurl']));
                }
                if(
$vbulletin->options['thread_thumbnails_thumbnail_source'] == '2')
                {
                
preg_match('/\[img\](.*?)\[\/img\]/i',$post['message'],$matches);
                
                
$dataman->setr('thumbnailurl'$matches[1]);
                }              
            } 


phkk 12-10-2009 03:06 PM

if ($type == 'thread')
{
if($vbulletin->options['thread_thumbnails_thumbnail_source'] == '0')
{
$dataman->setr('thumbnailurl', htmlspecialchars_uni($post['thumbnailurl']));
}
if($vbulletin->options['thread_thumbnails_thumbnail_source'] == '2')
{
preg_match('/\[img\](.*?)\[\/img\]/i',$post['message'],$matches);

$dataman->setr('thumbnailurl', $matches[1]);
}
}

phkk 12-10-2009 03:26 PM

not work
$pat = '/\[IMG\](.*?)\[\/IMG\]/i';
preg_match($pat,$pagetext,$matches);
$thumburl = escape_string($matches[1]);
$itemdata->set('thumbnailurl', $thumburl);

phkk 12-10-2009 04:01 PM

If you have RSS posts going to a forum like I do, you will have to do this:
in includes/cron/rssposter.php find
PHP Code:
$threadactiontime = (($feed['threadactiondelay'] > 0) ? (TIMENOW + $feed['threadactiondelay'] * 3600) : 0);

Put this below

preg_match('/\[img\](.*?)\[\/img\]/i',$pagetext,$matches);
$thumburl = ($matches[1]);
$itemdata->set('thumbnailurl', $thumburl);

now the thumbnail will appear on forum display like regular thread posts

The code work on my 3.8.4

it will draw the thumb from {feed:description}

any one know how to edit the {feed:description} and make it shorter or delete some characters?

Taurus1 12-16-2009 12:43 PM

Quote:

Originally Posted by Leonard (Post 1928141)
Hey guys,

So I had the same problem as some of you where, if you use attachments, only the first thread shows up on forumdisplay and all the other threads mysteriously disappear.

After a bit of digging the culprit was actually in a missing "group by" clause in the SQL statement.

Solution
Edit the plugin "Forum Display - Query"

Change the code to this:

Code:

$dothumbnail = false;
if((THIS_SCRIPT == 'forumdisplay') && ($vbulletin->options['thread_thumbnails_active'] == '1')){
        if ($vbulletin->options['thread_thumbnails_forum_list'] && $vbulletin->options['thread_thumbnails_forum_list'] != "") {
                $forumsallowed = explode(",", $vbulletin->options['thread_thumbnails_forum_list']);
                if (in_array($foruminfo['forumid'], $forumsallowed)){
                        $dothumbnail = true;
                        if($vbulletin->options['thread_thumbnails_thumbnail_source'] == '1'){
                                $hook_query_joins .= "LEFT JOIN " . TABLE_PREFIX . "attachment AS attachment ON (attachment.postid = thread.firstpostid AND attachment.extension IN('jpg', 'gif', 'png', 'jpeg', 'bmp'))";
                                $hook_query_fields .= ", MIN(attachment.attachmentid) AS attachmentid";
                                $hook_query_where .= "GROUP BY thread.threadid";

                        } else {
                                $hook_query_fields .= ", thread.thumbnailurl AS thumbnailurl";
                        }
                }
        }
}

The missing line was
Code:

$hook_query_where .= "GROUP BY thread.threadid";
Working now....

Leo

Thanks mate! That did it!! :D

fredang85 12-16-2009 02:40 PM

Take a look here

When there is no attached pictures, there is a broken image.


All times are GMT. The time now is 05:26 AM.

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.01535 seconds
  • Memory Usage 1,760KB
  • 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
  • (4)bbcode_code_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (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