vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Custom Variable in Postbit (https://vborg.vbsupport.ru/showthread.php?t=285989)

evenmonkeys 07-27-2012 04:17 AM

Custom Variable in Postbit
 
I want to make a plugin, place a variable in it, and call it in "postbit_legacy". I can't figure out the plugin hook I use. I tried "postbit_display_start" but it didn't work. It actually broke my forum.

Any direction will be appreciated.

evenmonkeys 07-29-2012 03:38 AM

Still trying to figure this out. -_-;

HMBeaty 07-29-2012 03:41 AM

More information would be nice ;) For example.... what is the code you are trying to use? What do you mean it broke your forum? What exactly are you trying to do/accomplish?

evenmonkeys 07-29-2012 04:45 AM

I made a table for a game on my forum. In that table is a score for each user. I want to display that score on the postbit. I can't figure it out.

Lynne 07-29-2012 05:53 PM

So post the code you have written and let us see where you went wrong.

evenmonkeys 07-30-2012 04:55 AM

Plugin: postbit_display_start
Code:

$gameuserid = $post['userid'];
$player_sql = $vbulletin->db->query("SELECT * FROM gametable WHERE userid = '$gameuserid'");
$player = $vbulletin->db->fetch_array($player_sql);
  $player_score = $player['score'];



Template
: postbit_legacy
Code:

Score: $player_score


Gives this error
:
Fatal error: Call to a member function query() on a non-object in /forums/includes/class_postbit.php(265) : eval()'d code on line 86

Lynne 07-30-2012 03:59 PM

I've always used postbit_display_complete for adding stuff to the postbit.

You may need to use $this->post instead of $post. Also, aren't you only getting one result? If so, use query_first. https://www.vbulletin.com/docs/html/...ards_sql_query

evenmonkeys 07-31-2012 02:25 AM

Well, I guess what has me confused.. is that if I were to pull out everything in my plugin and change the entire thing to one line of code:
Code:

$variable = $post['userid'];
This will actually show that user's userid on each individual post. But once I throw the queries in there, it doesn't work for some reason.

How do I use the information I pull from the table if I do that? Right now, I would have something like:
Code:

$player[field]
Still getting the same error as I switch around my queries.

kh99 07-31-2012 10:44 AM

Quote:

Originally Posted by evenmonkeys (Post 2352636)
Fatal error: Call to a member function query() on a non-object in /forums/includes/class_postbit.php(265) : eval()'d code on line 86

You probably need
Code:

global $vbulletin;

at the beginning of your code.


All times are GMT. The time now is 10:04 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.01489 seconds
  • Memory Usage 1,727KB
  • 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
  • (5)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete