vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Adding a field into the edit forum menu.. (https://vborg.vbsupport.ru/showthread.php?t=101758)

TyleR 11-28-2005 06:28 AM

Adding a field into the edit forum menu..
 
Okay, coming down to the last thing for this mod conversion to vB 3.5.x, was testing it, all code works fine, but when I enable this to work for a specific forum, I get this error:

Quote:

Fatal error: Field hack_poster is not defined in $validfields in class vb_datamanager_forum in /includes/class_dm.php on line 483
How would I go about making it a valid field?

Thanks!

- Tyler

Marco van Herwaarden 11-28-2005 06:52 AM

PHP Code:

$dm_object->validfields['hack_poster'] = array(TYPE_UINTREQ_NO); 

Ofcourse you will need to adjust the values.

TyleR 11-28-2005 06:55 AM

Quote:

Originally Posted by MarcoH64
PHP Code:

$dm_object->validfields['hack_poster'] = array(TYPE_UINTREQ_NO); 

Ofcourse you will need to adjust the values.

Where would this be added to? the area added in forum.php was done by a plugin:

Code:

                <plugin active="1">
                <title>Forum Admin Tables</title>
                <hookname>forumadmin_edit_form</hookname>
                <phpcode><![CDATA[print_table_header($vbphrase['enable_disable_features_hacks']);
        print_yes_no_row('Enable Hack Poster', 'forum[hack_poster]', $forum['hack_poster']);
        print_yes_no_row('Show Uninstall Button', 'forum[hack_poster_private]', $forum['hack_poster_private']);]]></phpcode>
                </plugin>


merk 11-28-2005 07:20 AM

youll need to put it into the hook that is inside the constructor for the forum datamanager.

TyleR 11-28-2005 06:02 PM

thanks for that, but it couldnt be added by a hook, i actually had to add it to includes/class_dm_forum.php

But, everything else is sorted, now i get this:

Code:

Database error in vBulletin 3.5.1:

Invalid SQL:
SELECT userid FROM lockdown_install WHERE threadid=1 AND userid=Array[userid];

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 '[userid]' at line 1
Error Number : 1064
Date        : Monday, November 28th 2005 @ 01:59:14 PM
Script      : /dev/showthread.php?p=1
Referrer    : /dev/index.php?
IP Address  : xx.xx.xx.xx
Username    : TwiSteD
Classname    : vb_database

this is the plugin code thats causing the error:

PHP Code:

if ($foruminfo['hack_poster'] == 1)
    {
        
// lets get all the lockdown information from the database for that thread
        
$hacks $db->query_read("
                SELECT *
                FROM " 
TABLE_PREFIX "lockdown
                WHERE threadid = '" 
$threadinfo['threadid'] . "'
        "
);

        
$install_check '';
        
$install_button '';
        
$hack_options '';

        
$verif $db->query_read("SELECT userid FROM "TABLE_PREFIX ."lockdown_install WHERE threadid=$threadinfo[threadid] AND userid=$vbulletin->userinfo[userid]");

        if (
$verif)
        {
            
$install_check true;
        }
        else
        {
            
$install_check false;
        }

        if ((
$foruminfo['hack_poster_private'] == 1) AND ($verif))
        {
            eval(
'$install_button = "' fetch_template('hack_uninstall') . '";');
        }
        else if ((
$foruminfo['hack_poster_private'] ==1) AND (!$verif))
        {
            eval(
'$install_button = "' fetch_template('hack_install') . '";');
        }
        else if ((!
$foruminfo['hack_poster_private'] ==1) AND ($verif))
        {
            
$install_button '';
        }
        else
        {
            eval(
'$install_button = "' fetch_template('hack_install') . '";');
        }

        if(!
$hacks['dateline'])
        {
            
$hacks['postdate'] = '';
            
$hacks['posttime'] = '';
        }
        else
        {
            
$hacks['postdate'] = vbdate($vboptions['dateformat'], $hacks['dateline'], true);
            
$hacks['posttime'] = vbdate($vboptions['timeformat'], $hacks['dateline']);
        }

        if(!
$hacks['updated'])
        {
            
$hacks['update'] = '';
            
$hacks['updatetime'] = '';
        }
        else
        {
            
$hacks['update'] = vbdate($vboptions['dateformat'], $hacks['updated'], true);
            
$hacks['updatetime'] = vbdate($vboptions['timeformat'], $hacks['updated']);
        }

        if ((
$vbulletin->userinfo['usergroupid'] == 6) || ($vbulletin->userinfo['usergroupid'] == 7) || ($vbulletin->userinfo['usergroupid'] == 5))
        {
            
$hack_options true;
            eval(
'$hack_options = "' fetch_template('hack_moderator_options') . '";');
        }
        else
        {
            
$hack_options '';
        } 

    } 


merk 11-28-2005 08:52 PM

It can be added via forumdata_start, just like i said :confused:

The problem you face is an itchy one, $vbulletin->userinfo is being parsed without the array component after it. Either take it out of quotes (and use . to append) or surround it in braces, like {$vbulletin->userinfo[userid]}

TyleR 11-29-2005 02:26 AM

i used that hook location, it did nothing, i still recieved that error after trying that.

anyways, the previous post i did, was solved by just appending it in quotes..next error (sheesh, this stinks..so many errors in testing stages, heh!)

Code:

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/tyler/public_html/.../showthread.php(921) : eval()'d code on line 25
its the same plugin i posted a few up, just with that line edited.

merk 11-29-2005 09:05 PM

You obviously didnt do it right :p

PHP Code:

 if ($foruminfo['hack_poster'] == 1
    { 
        
// lets get all the lockdown information from the database for that thread 
        
$hacks $db->query_read(
                SELECT * 
                FROM " 
TABLE_PREFIX "lockdown 
                WHERE threadid = '" 
$threadinfo['threadid'] . "' 
        "
); 

        
$install_check ''
        
$install_button ''
        
$hack_options ''

        
$verif $db->query_read("SELECT userid FROM "TABLE_PREFIX ."lockdown_install WHERE threadid=$threadinfo[threadid] AND userid={$vbulletin->userinfo[userid]}"); 

        if (
$verif
        { 
            
$install_check true
        } 
        else 
        { 
            
$install_check false
        } 

        if ((
$foruminfo['hack_poster_private'] == 1) AND ($verif)) 
        { 
            eval(
'$install_button = "' fetch_template('hack_uninstall') . '";'); 
        } 
        else if ((
$foruminfo['hack_poster_private'] ==1) AND (!$verif)) 
        { 
            eval(
'$install_button = "' fetch_template('hack_install') . '";'); 
        } 
        else if ((!
$foruminfo['hack_poster_private'] ==1) AND ($verif)) 
        { 
            
$install_button ''
        } 
        else 
        { 
            eval(
'$install_button = "' fetch_template('hack_install') . '";'); 
        } 

        if(!
$hacks['dateline']) 
        { 
            
$hacks['postdate'] = ''
            
$hacks['posttime'] = ''
        } 
        else 
        { 
            
$hacks['postdate'] = vbdate($vboptions['dateformat'], $hacks['dateline'], true); 
            
$hacks['posttime'] = vbdate($vboptions['timeformat'], $hacks['dateline']); 
        } 

        if(!
$hacks['updated']) 
        { 
            
$hacks['update'] = ''
            
$hacks['updatetime'] = ''
        } 
        else 
        { 
            
$hacks['update'] = vbdate($vboptions['dateformat'], $hacks['updated'], true); 
            
$hacks['updatetime'] = vbdate($vboptions['timeformat'], $hacks['updated']); 
        } 

        if ((
$vbulletin->userinfo['usergroupid'] == 6) || ($vbulletin->userinfo['usergroupid'] == 7) || ($vbulletin->userinfo['usergroupid'] == 5)) 
        { 
            
$hack_options true
            eval(
'$hack_options = "' fetch_template('hack_moderator_options') . '";'); 
        } 
        else 
        { 
            
$hack_options ''
        }  

    } 

Or (just the query)

PHP Code:

        $verif $db->query_read("SELECT userid FROM "TABLE_PREFIX ."lockdown_install WHERE threadid=$threadinfo[threadid] AND userid="$vbulletin->userinfo[userid]); 


TyleR 11-30-2005 02:56 AM

now I get:

Code:

Warning: Cannot use a scalar value as an array in /showthread.php(921) : eval()'d code on line 44

Warning: Cannot use a scalar value as an array in /showthread.php(921) : eval()'d code on line 45

Warning: Cannot use a scalar value as an array in /showthread.php(921) : eval()'d code on line 55

Warning: Cannot use a scalar value as an array in /showthread.php(921) : eval()'d code on line 56

Sigh..so frustrating :(

Thanks a bunch for your help thus far, merk :)

merk 11-30-2005 11:24 PM

You didnt update the query properly.

It needs both a { and a } around the entire variable (and youve only put a } at the end)


All times are GMT. The time now is 01:46 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.02153 seconds
  • Memory Usage 1,817KB
  • 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
  • (5)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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