The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
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. |
#2
|
||||
|
||||
Still trying to figure this out. -_-;
|
#3
|
||||
|
||||
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?
|
#4
|
||||
|
||||
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.
|
#6
|
||||
|
||||
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 |
#7
|
||||
|
||||
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 |
#8
|
||||
|
||||
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']; 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] |
#9
|
|||
|
|||
Quote:
Code:
global $vbulletin; at the beginning of your code. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|