Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 11-28-2005, 06:28 AM
TyleR's Avatar
TyleR TyleR is offline
 
Join Date: Nov 2004
Location: North Carolina
Posts: 349
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 11-28-2005, 06:52 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$dm_object->validfields['hack_poster'] = array(TYPE_UINTREQ_NO); 
Ofcourse you will need to adjust the values.
Reply With Quote
  #3  
Old 11-28-2005, 06:55 AM
TyleR's Avatar
TyleR TyleR is offline
 
Join Date: Nov 2004
Location: North Carolina
Posts: 349
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #4  
Old 11-28-2005, 07:20 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

youll need to put it into the hook that is inside the constructor for the forum datamanager.
Reply With Quote
  #5  
Old 11-28-2005, 06:02 PM
TyleR's Avatar
TyleR TyleR is offline
 
Join Date: Nov 2004
Location: North Carolina
Posts: 349
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 '';
        } 

    } 
Reply With Quote
  #6  
Old 11-28-2005, 08:52 PM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It can be added via forumdata_start, just like i said

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]}
Reply With Quote
  #7  
Old 11-29-2005, 02:26 AM
TyleR's Avatar
TyleR TyleR is offline
 
Join Date: Nov 2004
Location: North Carolina
Posts: 349
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 11-29-2005, 09:05 PM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You obviously didnt do it right

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]); 
Reply With Quote
  #9  
Old 11-30-2005, 02:56 AM
TyleR's Avatar
TyleR TyleR is offline
 
Join Date: Nov 2004
Location: North Carolina
Posts: 349
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #10  
Old 11-30-2005, 11:24 PM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You didnt update the query properly.

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

Thread Tools
Display Modes

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 12:03 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.07841 seconds
  • Memory Usage 2,324KB
  • Queries Executed 13 (?)
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)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (5)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_postinfo_query
  • fetch_postinfo
  • 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