vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Forum Home Enhancements - Welcome Panel Template Rewrite (https://vborg.vbsupport.ru/showthread.php?t=118385)

AzH 05-09-2008 07:17 PM

Quote:

(Confirmed working with vB 3.7.0 RC1)
I just tried to install on 3.7 Gold and got a db error.

King Kovifor 05-09-2008 07:24 PM

There is a patch on one of these pages. I really should link to it.

AzH 05-09-2008 07:25 PM

It's here: https://vborg.vbsupport.ru/showpost....&postcount=151

I just tried it and got the same error??

Quote:

Database error in vBulletin 3.7.0:

Invalid SQL:
SELECT COUNT(*) AS newposts FROM post WHERE dateline >= 02:07 PM, 9th May 2008 AND visible = 1;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':07 PM, 9th May 2008 AND visible = 1' at line 1
Error Number : 1064
Request Date : Friday, May 9th 2008 @ 04:23:48 PM
Error Date : Friday, May 9th 2008 @ 04:23:48 PM
Script : http://devioustyrant.com/index.php
Referrer :
IP Address :
Username : AzH
Classname : vb_database
MySQL Version : 4.1.22-standard

King Kovifor 05-09-2008 07:28 PM

Can you post your Main Plugin?

AzH 05-09-2008 07:34 PM

Welcome Panel - Main

Code:

if ($vbulletin->userinfo['userid'] > 0 && $vbulletin->userinfo['userid'] != '' || !$vbulletin->userinfo['userid'])
{
    require_once(DIR . '/includes/functions_user.php');
    $vbulletin->userinfo['avatar_build'] = fetch_avatar_url($vbulletin->userinfo['userid']);

    if (empty($vbulletin->userinfo['avatar_build']) || !is_array($vbulletin->userinfo['avatar_build']))
    {
        $vbulletin->userinfo['avatar_build'] = array($vbulletin->options['wp_forumimagelink'] . 'noavatar.gif');
    }

    $vbulletin->userinfo['avatar_build'] = '<img src="' . $vbulletin->userinfo['avatar_build'][0] . '"'.iif($vbulletin->userinfo['avatar_build'][1],$vbulletin->userinfo['avatar_build'][1],'').'border="0" alt="Edit Your Avatar" />';

    $postsin = array();
    $gp      = $db->query_read("SELECT p.threadid, t.forumid FROM " . TABLE_PREFIX . "post p LEFT JOIN " . TABLE_PREFIX . "thread t ON(t.threadid = p.threadid) WHERE p.userid = {$vbulletin->userinfo['userid']}");
    while ($gpb = $db->fetch_array($gp))
    {
        if (!$postsin[$gpb['forumid']])
        {
            $postsin[$gpb['forumid']] = 1;
        }
        else
        {
            $postsin[$gpb['forumid']]++;
        }
    }

    $active = array(0);

    if (is_array($postsin) && is_array($vbulletin->forumcache))
    {
        foreach ($postsin as $forumid => $pi)
        {
            if ($pi > $active[0])
            {
                $active = array($pi, $forumid);
            }
        }
    }

    if (!empty($active[1]))
    {
        $vbulletin->userinfo['active'] = array($vbulletin->forumcache[$active[1]], $active[0]);
    }
    else
    {
        $vbulletin->userinfo['active'] = false;
    }

    $exec_totalposts = str_replace(',', '', $totalposts);

    if ($exec_totalposts < 1)
    {
        $exec_totalposts = 1;
    }

    $vbulletin->userinfo['posts'] = vb_number_format($vbulletin->userinfo['posts']);
    $jointime = (TIMENOW - $vbulletin->userinfo['joindate']) / 86400;

    if ($jointime < 1)
    {
        $vbulletin->userinfo['postsperday'] = $vbulletin->userinfo['posts'];
    }
    else
    {
        $vbulletin->userinfo['postsperday'] = vb_number_format(str_replace(',', '', $vbulletin->userinfo['posts']) / $jointime, 2);
    }

    $vbulletin->userinfo['postpercent'] = vb_number_format(((str_replace(',', '', $vbulletin->userinfo['posts']) / $exec_totalposts ) * 100),2);

    $vbulletin->userinfo['newposts'] = $db->query_first("SELECT COUNT(*) AS newposts FROM " . TABLE_PREFIX . "post WHERE dateline >= '{$vbulletin->userinfo['lastvisit']}' AND visible = '1'");
    $vbulletin->userinfo['newposts'] = vb_number_format($vbulletin->userinfo['newposts']['newposts']);

    $vbulletin->userinfo['newthreads'] = $db->query_first("SELECT COUNT(*) AS newthreads FROM " . TABLE_PREFIX . "thread WHERE dateline >= '{$vbulletin->userinfo['lastvisit']}' AND visible = '1' AND sticky in(0,1)");
    $vbulletin->userinfo['newthreads'] = vb_number_format($vbulletin->userinfo['newthreads']['newthreads']);

    $vbulletin->userinfo['lastvisit'] = vbdate($vbulletin->options['timeformat'], $vbulletin->userinfo['lastvisit']) . ', ' . vbdate($vbulletin->options['dateformat'], $vbulletin->userinfo['lastvisit']);

    $exec_lastposts = $db->query_first("SELECT COUNT(*) AS lastposts FROM " . TABLE_PREFIX . "post WHERE visible = 1 AND dateline >= ".(TIMENOW - 86400));
    $exec_lastposts = vb_number_format($exec_lastposts['lastposts']);

    $vbulletin->templatecache['FORUMHOME'] = str_replace('$navbar','$navbar ' . $vbulletin->templatecache['forumhome_welcomepanel_' . $vbulletin->options['wp_style']],$vbulletin->templatecache['FORUMHOME']);
}


King Kovifor 05-09-2008 08:09 PM

Try...
PHP Code:

if ($vbulletin->userinfo['userid'] > && $vbulletin->userinfo['userid'] != '' || !$vbulletin->userinfo['userid'])
{
    require_once(
DIR '/includes/functions_user.php');
    
$vbulletin->userinfo['avatar_build'] = fetch_avatar_url($vbulletin->userinfo['userid']);

    if (empty(
$vbulletin->userinfo['avatar_build']) || !is_array($vbulletin->userinfo['avatar_build']))
    {
        
$vbulletin->userinfo['avatar_build'] = array($vbulletin->options['wp_forumimagelink'] . 'noavatar.gif');
    }

    
$vbulletin->userinfo['avatar_build'] = '<img src="' $vbulletin->userinfo['avatar_build'][0] . '"'.iif($vbulletin->userinfo['avatar_build'][1],$vbulletin->userinfo['avatar_build'][1],'').'border="0" alt="Edit Your Avatar" />';

    
$postsin = array();
    
$gp      $db->query_read("SELECT p.threadid, t.forumid FROM " TABLE_PREFIX "post p LEFT JOIN " TABLE_PREFIX "thread t ON(t.threadid = p.threadid) WHERE p.userid = {$vbulletin->userinfo['userid']}");
    while (
$gpb $db->fetch_array($gp))
    {
        if (!
$postsin[$gpb['forumid']])
        {
            
$postsin[$gpb['forumid']] = 1;
        }
        else
        {
            
$postsin[$gpb['forumid']]++;
        }
    }

    
$active = array(0);

    if (
is_array($postsin) && is_array($vbulletin->forumcache))
    {
        foreach (
$postsin as $forumid => $pi)
        {
            if (
$pi $active[0])
            {
                
$active = array($pi$forumid);
            }
        }
    }

    if (!empty(
$active[1]))
    {
        
$vbulletin->userinfo['active'] = array($vbulletin->forumcache[$active[1]], $active[0]);
    }
    else
    {
        
$vbulletin->userinfo['active'] = false;
    }

    
$exec_totalposts str_replace(','''$totalposts);

    if (
$exec_totalposts 1)
    {
        
$exec_totalposts 1;
    }

    
$vbulletin->userinfo['posts'] = vb_number_format($vbulletin->userinfo['posts']);
    
$jointime = (TIMENOW $vbulletin->userinfo['joindate']) / 86400;

    if (
$jointime 1)
    {
        
$vbulletin->userinfo['postsperday'] = $vbulletin->userinfo['posts'];
    }
    else
    {
        
$vbulletin->userinfo['postsperday'] = vb_number_format(str_replace(','''$vbulletin->userinfo['posts']) / $jointime2);
    }

    
$vbulletin->userinfo['postpercent'] = vb_number_format(((str_replace(','''$vbulletin->userinfo['posts']) / $exec_totalposts ) * 100),2);

    
$vbulletin->userinfo['newposts'] = $db->query_first("SELECT COUNT(*) AS newposts FROM " TABLE_PREFIX "post WHERE dateline >= '" $vbulletin->userinfo['lastvisit'] ."' AND visible = '1'");
    
$vbulletin->userinfo['newposts'] = vb_number_format($vbulletin->userinfo['newposts']['newposts']);

    
$vbulletin->userinfo['newthreads'] = $db->query_first("SELECT COUNT(*) AS newthreads FROM " TABLE_PREFIX "thread WHERE dateline >= '" $vbulletin->userinfo['lastvisit'] ."' AND visible = '1' AND sticky in(0,1)");
    
$vbulletin->userinfo['newthreads'] = vb_number_format($vbulletin->userinfo['newthreads']['newthreads']);

    
$vbulletin->userinfo['lastvisit'] = vbdate($vbulletin->options['timeformat'], $vbulletin->userinfo['lastvisit']) . ', ' vbdate($vbulletin->options['dateformat'], $vbulletin->userinfo['lastvisit']);

    
$exec_lastposts $db->query_first("SELECT COUNT(*) AS lastposts FROM " TABLE_PREFIX "post WHERE visible = 1 AND dateline >= ".(TIMENOW 86400));
    
$exec_lastposts vb_number_format($exec_lastposts['lastposts']);

    
$vbulletin->templatecache['FORUMHOME'] = str_replace('$navbar','$navbar ' $vbulletin->templatecache['forumhome_welcomepanel_' $vbulletin->options['wp_style']],$vbulletin->templatecache['FORUMHOME']);



AzH 05-09-2008 08:14 PM

Quote:

Database error in vBulletin 3.7.0:

Invalid SQL:
SELECT COUNT(*) AS newposts FROM post WHERE dateline >= 02:07 PM, 9th May 2008 AND visible = 1;

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':07 PM, 9th May 2008 AND visible = 1' at line 1
Error Number : 1064
Request Date : Friday, May 9th 2008 @ 05:13:41 PM
Error Date : Friday, May 9th 2008 @ 05:13:42 PM
Script : http://devioustyrant.com/index.php
Referrer :
IP Address :
Username : AzH
Classname : vb_database
MySQL Version : 4.1.22-standard

No luck. :/

It's good of you to care enough to help out.

King Kovifor 05-09-2008 08:21 PM

This may sound stupid, but are you SURE that you have update the code? As the error is because of not adding a ' ' around the date.

AzH 05-09-2008 08:27 PM

Sorry, I'm a clutz. I updated the wrong welcome panel. I did vBulletins rather than the WPTR plugin. So now it's displaying twice. ;) Woo, go me!!

King Kovifor 05-09-2008 10:42 PM

Ah. That's cool. My tip off was the same exact error message. :P


All times are GMT. The time now is 09:10 PM.

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