sifo
10-13-2007, 05:11 PM
I am trying to add a field in the postbit to display the users current DKP. I am somewhat of a novice but I have been learning rather quickly. The way my site is set up is that the EQDKP site and the vBulletin forums are separate MYSQL databases.
The way I envision this working is that I create a new User Profile Field through the Admin CP. It is just a string. My users enter their userid from our DKP site into that field. With this string entered into the 'fieldXX' (field6 for my board), I can use that string to index my array and extract the pertinent data to calculate the current DKP.
The code below works properly by itself but I don't have enough knowledge to incorporate it into vBulletin. I'm not sure if this is too much of a bother to even worry about or if it would take just a few lines in the right place - any help would be greatly appreciated.
<?php
mysql_connect("myserver.net","myusername","mypassword") or die(mysql_error());
mysql_select_db("mydatabase") or die(mysql_error());
// $dkpname is the string that will come from 'fieldXX' which is a user defined profile field to display in the postbit
$yourdkpname = mysql_query("SELECT * FROM eqdkp_members
WHERE member_name= '$dkpname'") or die(mysql_error());
$data = mysql_fetch_array($yourdkpname);
$yourdkp = $data['member_earned'] - $data['member_spent'] + $data['member_adjustment'];
// $yourdkp is the current dkp that I want to be displayed in the postbit
?>
The way I envision this working is that I create a new User Profile Field through the Admin CP. It is just a string. My users enter their userid from our DKP site into that field. With this string entered into the 'fieldXX' (field6 for my board), I can use that string to index my array and extract the pertinent data to calculate the current DKP.
The code below works properly by itself but I don't have enough knowledge to incorporate it into vBulletin. I'm not sure if this is too much of a bother to even worry about or if it would take just a few lines in the right place - any help would be greatly appreciated.
<?php
mysql_connect("myserver.net","myusername","mypassword") or die(mysql_error());
mysql_select_db("mydatabase") or die(mysql_error());
// $dkpname is the string that will come from 'fieldXX' which is a user defined profile field to display in the postbit
$yourdkpname = mysql_query("SELECT * FROM eqdkp_members
WHERE member_name= '$dkpname'") or die(mysql_error());
$data = mysql_fetch_array($yourdkpname);
$yourdkp = $data['member_earned'] - $data['member_spent'] + $data['member_adjustment'];
// $yourdkp is the current dkp that I want to be displayed in the postbit
?>