PDA

View Full Version : Syntax help..


tinycg
10-06-2007, 02:05 PM
I've been up all night, among the things I'm looking to figure out is how to just grab an array out of vB to use in the postbit.

It was suggested I use a plugin architecture after some fiddling earlier. But I'm still having issues, can anyone help??

<?xml version="1.0" encoding="ISO-8859-1"?>


<plugins>
<plugin active="1" executionorder="5" product="vbulletin">
<title>Gamerscore in Postbit</title>
<hookname>postbit_display_start</hookname>
<![CDATA[$usersid = $this->post['userid'];
$xbl = mysql_query("SELECT userid,score FROM " . TABLE_PREFIX . "gxboxlive WHERE userid='$usersid'");
$score = mysql_fetch_array($xbl);]]>
</plugin>
</plugins>


edit: I've also tried db-> fetch etc.. it always gives me an error, this cant be THAT hard.

Opserty
10-06-2007, 03:05 PM
Just to check...you know you can do this in the AdminCP right?

Regarding your actual problem...

$xbl = $this->registry->db->query_first("SELECT `score` FROM ". TABLE_PREFIX ."gxboxlive WHERE `userid` = '". $this->post['userid'] ."' LIMIT 1");
$score = $xbl['score']; // $score contains the value =)

See if that works, I think it should :P

tinycg
10-06-2007, 08:34 PM
Opserty,

I'm not sure what you mean, is there a better point and click kinda way in the AdminCP I know about profile fields, but wasnt sure how they could help in this instance.

Yeah your idea did work, I was trying to put it in an array so I wouldnt have to do a DB query for each post just to get the data.

But maybe I'm wrong about that.

Oh and thank you very much for the help.

Opserty
10-06-2007, 09:30 PM
Opserty,
I'm not sure what you mean, is there a better point and click kinda way in the AdminCP I know about profile fields, but wasnt sure how they could help in this instance.

I mean you can create plugins in the AdminCP. Using the Plugin System (http://www.vbulletin.com/docs/html/plugin_system), I thought you were writing the code directly into an XML file then uploading it :p.