Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #11  
Old 12-30-2009, 08:27 PM
Warlord's Avatar
Warlord Warlord is offline
 
Join Date: Jan 2002
Location: TN, USA
Posts: 668
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the help, unfortunately every time I get one thing done something else is wrong.

Now it's telling me that the function name must be a string (on line 245).

I researched that error code and found this...

Quote:
Well, I found the problem. It seems that I had a pair of parens ()' around the index of an array element instead of brackets []'s. Hence it was looking at a variable as a function. I.e.
Wrong: $arName('myindex')
Right: $arName['myindex']

http://www.webdeveloper.com/forum/sh...ad.php?t=81233
I figured maybe a variable in the array I was calling was being looked at as if it were a function like above, so I looked through the code and changed the parenthesis() around "SELECT * FROM " . TABLE_PREFIX . "formresults WHERE userid = '$bbuserinfo[userid]' , AND title = 'Resume' " to brackets[] but then I got this error.

Fatal error: Cannot use object of type vB_Database as array in /home/righscom/public_html/addons/projectfanboy/vb/member.php(463) : eval()'d code on line 245

But now that I look at it, I think that the parenthesis were right because even though it's part of the variable $db, it's still a sql query, right?

I think it's saying that I can't use the variable $db and I have to use a string instead for that part?

Anyway, I changed it back to parenthesis() and now I'm back to:

Fatal error: Function name must be a string in /home/righscom/public_html/addons/projectfanboy/vb/member.php(463) : eval()'d code on line 245

I'll keep researching.

--------------- Added [DATE]1262213487[/DATE] at [TIME]1262213487[/TIME] ---------------

Ok, I was re-reading your post and I think I was misunderstanding something before and it helps me to talk it out on "paper" so to speak.

Arrays look similar to variables.
Arrays are basically variables that hold multiple other variables (aka an array of other variables).

So, $db("SELECT * FROM " . TABLE_PREFIX . "formresults WHERE userid = '$bbuserinfo[userid]' , AND title = 'Resume' ") is not a variable but actually an array that uses a SQL query to generate its results.

But this is also an array, right?
Code:
array(
        'class' => 'resume',
        'title' => 'Resume',
        'hook_location' => 'profile_left_last'
    )
I think I may be starting to see the light.... (I'll probably edit this 15 more times while I look at it and think. )

--------------- Added [DATE]1262215159[/DATE] at [TIME]1262215159[/TIME] ---------------

Hmmm, I also found this...

Quote:
There's also another problem that will cause the same type of response (function must be a string) and that's inadvertently including a $ in front of a predefined/language defined function.
So I tried removing the $ from in front of the "predefined function" $db but that gave me a different error so I changed it back. Still looking!

--------------- Added [DATE]1262215901[/DATE] at [TIME]1262215901[/TIME] ---------------

Ok, to see if this would work (it didn't but I'm trying to think outside the box )

I globalised $db and defined $resume as the sql query earlier in the code and then I defined $this->block_data['resume'] as $resume so the code looked like this.

Code:
{
	global $db;
	$resume = $db("SELECT * FROM " . TABLE_PREFIX . "formresults WHERE userid = '$bbuserinfo[userid]' , AND title = 'Resume' ");
}

$blocklist = array_merge($blocklist, array(
    'resume' => array(
        'class' => 'resume',
        'title' => 'Resume',
        'hook_location' => 'profile_left_last'
    )
));

class vB_ProfileBlock_resume extends vB_ProfileBlock
{
  var $template_name = 'memberinfo_block_resume';
  function confirm_empty_wrap()
  {
    return false;
  }
  function confirm_display()
  {
    return ($this->block_data['resume'] != '');
  }
  function prepare_output($id = '', $options = array())
  {

    $this->block_data['resume'] = $resume;
  }
}
Like I said, it didn't work and I got the exact same error on a different line, but I get the feeling I may be on the right track?

--------------- Added [DATE]1262224021[/DATE] at [TIME]1262224021[/TIME] ---------------

Okay, here is the latest and greatest code for my plugin which seems to be working other than the fact that I don't think $bbuserinfo[userid] is parsing and so nothing shows up. But on a good note, I don't seem to be getting any errors anymore.

Code:
{
	global $db;
	$resume = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "formresults WHERE userid = '$bbuserinfo[userid]' AND title = 'Resume' ");
}  

$blocklist = array_merge($blocklist, array(
    'resume' => array(
        'class' => 'resume',
        'title' => 'Resume',
        'hook_location' => 'profile_left_last'
    )
));

class vB_ProfileBlock_resume extends vB_ProfileBlock
{
  var $template_name = 'memberinfo_block_resume';
  function confirm_empty_wrap()
  {
    return false;
  }
  function confirm_display()
  {
    return ($this->block_data['resume'] != '');
  }
  function prepare_output($id = '', $options = array())
  {

    $this->block_data['resume'] = $resume;
  }
}
--------------- Added [DATE]1262224314[/DATE] at [TIME]1262224314[/TIME] ---------------

Well son of a mazza frazzer.... Just to test it out, I changed out $bbuserinfo[userid] for '162' (my userid) and nothing still showed up.

I really thought that would work....

--------------- Added [DATE]1262298398[/DATE] at [TIME]1262298398[/TIME] ---------------

Kind of at a point where I'm a bit stumped.
Reply With Quote
  #12  
Old 01-02-2010, 04:59 AM
Warlord's Avatar
Warlord Warlord is offline
 
Join Date: Jan 2002
Location: TN, USA
Posts: 668
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any ideas?
Reply With Quote
  #13  
Old 01-04-2010, 11:22 AM
Warlord's Avatar
Warlord Warlord is offline
 
Join Date: Jan 2002
Location: TN, USA
Posts: 668
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm making headway!

Code:
$blocklist = array_merge($blocklist, array(
    'resume' => array(
        'class' => 'Resume',
        'title' => 'Resume',
        'hook_location' => 'profile_left_last'
    )
));

class vB_ProfileBlock_resume extends vB_ProfileBlock
{
  var $template_name = 'memberinfo_block_resume';
  function confirm_empty_wrap()
  {
    return false;
  }
  function confirm_display()
  {
    return ($this->block_data['resume'] != '');
  }
	function prepare_output($id = '', $options = array())
{
	global $db;
	$results = $db->query_read("SELECT output FROM " . TABLE_PREFIX . "formresults WHERE userid = '$bbuserinfo[userid]' AND title = 'Resume' ");

    $this->block_data['resume'] = $results;
  }
}
That get's no errors in the header, adds the Resume Tab to the profile and data is displayed in the content portion of the tab. The data it's displaying is confusing the heck out of me, but it's still a great leap forward for me I think.

Resource id #73 (the number changes with each member) is being generated in the tab's content portion. Still looking into this.
Reply With Quote
Reply


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 11:17 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.03753 seconds
  • Memory Usage 2,195KB
  • Queries Executed 11 (?)
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
  • (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
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)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_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