The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Pulling age from Vbulletin Profiles
I have Vbulletin and RealChat integrated. I have the profile information from Vbulletin displayed for the chat room. There is one problem though. I can't get the age from Vbulletin to display in the chat room. Can anyone tell me how to do that? Here is the code I am using to display the information. Everything works good, except the age.
<param name="nick" value="<?php echo $vbulletin->userinfo[username];?>"> <param name="embedded" value="yes"> <param name="channel" value="room name"> <param name="pLabel1" value="Gender:"> <param name="pValue1" value="<?php echo $vbulletin->userinfo[field14];?>"> <param name="pLabel2" value="Age:"> <param name="pValue2" value="<?php echo $vbulletin->userinfo[age];?>"> <param name="pLabel3" value="Location:"> <param name="pValue3" value="<?php echo $vbulletin->userinfo[field2];?>"> <param name="pLabel4" value=""> <param name="pValue4" value=""> <param name="pLabel5" value=""> <param name="pValue5" value=""> <param name="pLabel6" value=""> <param name="pValue6" value=""> <param name="pLabel7" value=""> <param name="pValue7" value=""> <param name="pLabel8" value=""> <param name="pValue8" value=""> Thanks! Jaime |
#2
|
||||
|
||||
the age of a user is not a stored value in db, it is caculated depending on user's age, of course. Here is what vb staffs calculate in the file member.php:
PHP Code:
|
#3
|
|||
|
|||
Quote:
|
#4
|
||||
|
||||
I thought you know PHP, that code is php so you can put in a php page. if you can use the $vbulletin->userinfo[username] then I belive that code will work and give you $userinfo['age'], then use that for the member age. try this code:
PHP Code:
|
#5
|
|||
|
|||
Quote:
<?php error_reporting(E_ALL & ~E_NOTICE); define('NO_REGISTER_GLOBALS', 1); chdir('/home/httpd/vhosts/url.com/httpdocs/bbs'); require('/home/httpd/vhosts/url.com/httpdocs/bbs/global.php'); include('/home/httpd/vhosts/url.com/httpdocs/bbs/global.php'); chdir('/home/httpd/vhosts/url.com/httpdocs'); $userinfo['birthday'] = $vbulletin->userinfo['birthday']; $userinfo['showbirthday'] = $vbulletin->userinfo['showbirthday']; // BIRTHDAY // Set birthday fields right here! if ($userinfo['birthday'] AND $userinfo['showbirthday'] > 0) { $bday = explode('-', $userinfo['birthday']); $year = vbdate('Y', TIMENOW, false, false); $month = vbdate('n', TIMENOW, false, false); $day = vbdate('j', TIMENOW, false, false); if ($year > $bday[2] AND $bday[2] != '0000') { $userinfo['age'] = $year - $bday[2]; if ($month < $bday[0] OR ($month == $bday[0] AND $day < $bday[1])) { $userinfo['age']--; } if ($userinfo['age'] > 101) { // why can't we have 102 year old forum users? $show['age'] = false; } else { $show['age'] = true; $show['extrainfo'] = true; } } if ($userinfo['showbirthday'] == 2) { if ($year > $bday[2] AND $bday[2] > 1901 AND $bday[2] != '0000') { require_once(DIR . '/includes/functions_misc.php'); $vbulletin->options['calformat1'] = mktimefix($vbulletin->options['calformat1'], $bday[2]); if ($bday[2] >= 1970) { $yearpass = $bday[2]; } else { // day of the week patterns repeat every 28 years, so // find the first year >= 1970 that has this pattern $yearpass = $bday[2] + 28 * ceil((1970 - $bday[2]) / 28); } $userinfo['birthday'] = vbdate($vbulletin->options['calformat1'], mktime(0, 0, 0, $bday[0], $bday[1], $yearpass), false, true, false); } else { // lets send a valid year as some PHP3 don't like year to be 0 $userinfo['birthday'] = vbdate($vbulletin->options['calformat2'], mktime(0, 0, 0, $bday[0], $bday[1], 1992), false, true, false); } if ($userinfo['birthday'] == '') { if ($bday[2] == '0000') { $userinfo['birthday'] = "$bday[0]-$bday[1]"; } else { $userinfo['birthday'] = "$bday[0]-$bday[1]-$bday[2]"; } } $show['extrainfo'] = true; $show['birthday'] = true; } else { $show['birthday'] = false; } } if (!in_array($vbulletin->userinfo['usergroupid'], array(5,6,7,9,10))){ ?> <!-- CSS Stylesheet --> <link rel="stylesheet" type="text/css" href="../bbs/clientscript/vbulletin_css/chatlogin.css" id="vbulletin_css" /> <br> <table class="tborder" cellpadding="3" cellspacing="1" border="0" width="70%" align="center"> <tr> <td class="panelsurround" align="center"> <div class="panel"> <div align="left"> <script type="text/javascript" src="../bbs/clientscript/vbulletin_md5.js"></script> <form action="../bbs/login.php" target="_top" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)"> <input type="hidden" name="do" value="login" /> <input type="hidden" name="url" value="../chat/chat.html" /> <input type="hidden" name="vb_login_md5password" /> <input type="hidden" name="vb_login_md5password_utf" /> <input type="hidden" name="s" value="" /> <!-- permission error message - user not logged in --> <div align="center" class="mediumfont"><b>To Enter the Chat Room</b></div> <br> <br> <div align="center" class="mediumfont">You must have a registered chat name to enter our chat rooms. If you have<br> not yet registered your chat name and would like to do so, please <a href="../bbs/register.php?do=signup" target="_top">click here.</a></div> <br> <br> <fieldset class="fieldset"> <legend>Log in</legend> <table cellpadding="0" cellspacing="2" border="0" align="center"> <tr> <td>Chat Name:<br /><input type="text" class="bginput" name="vb_login_username" size="50" accesskey="u" tabindex="1" /></td> </tr> <tr> <td>Password:<br /><input type="password" class="bginput" name="vb_login_password" size="50" accesskey="p" tabindex="1" /></td> </tr> <tr> <td> <span style="float:right"><a href="../bbs/login.php?do=lostpw" target="_top">Forgotten Your Password?</a></span> <label for="cb_cookieuser"><input type="checkbox" name="cookieuser" value="1" id="cb_cookieuser" tabindex="1" />Remember Me?</label> </td> </tr> <tr> <td align="right"> <input type="submit" class="button" value="Log in" accesskey="s" tabindex="1" /> <input type="reset" class="button" value="Reset Fields" accesskey="r" tabindex="1" /> </td> </tr> </table> </fieldset> </form> <!-- / permission error message - user not logged in --> </div> </div> </td> </tr> </table> <? }else { ?> <html> <head> <title>Chat Login Page</title> <link rel="stylesheet" href="styles.css" type="text/css"> </HEAD> <BODY LEFTMARGIN=0 RIGHTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 TOPMARGIN=0> <center> <!-- Begin: RealChat Client code --> <applet archive = "RealChat.jar" codebase = "." code = "rcs.client.RealChatClient.class" name = "ChatClient" width = "100%" height = "100%" align = "top" alt = "RealChat Client applet" MAYSCRIPT> <param name="nick" value="<?php echo $vbulletin->userinfo[username];?>"> <param name="embedded" value="yes"> <param name="channel" value="Room"> <param name="pLabel1" value="Gender:"> <param name="pValue1" value="<?php echo $vbulletin->userinfo[field14];?>"> <param name="pLabel2" value="Age:"> <param name="pValue2" value="<?php echo $vbulletin->userinfo[birthday];?>"> <param name="pLabel3" value="Location:"> <param name="pValue3" value="<?php echo $vbulletin->userinfo[field2];?>"> <param name="pLabel4" value=""> <param name="pValue4" value=""> <param name="pLabel5" value=""> <param name="pValue5" value=""> <param name="pLabel6" value=""> <param name="pValue6" value=""> <param name="pLabel7" value=""> <param name="pValue7" value=""> <param name="pLabel8" value=""> <param name="pValue8" value=""> <param name="onCloseURL" value="http://www.url.com/index.php"> <!-- no java or java disabled --> RealChat client requires Java compatible web browser<br>For more information visit our <a target="_blank" href="http://www.realchat.com/">java chat software</a> support page<br><br><a target="_blank" href="http://www.java.com/"><img src="getjava.gif" alt="Java - Get it now!" width="88" height="31" border="0"></a><br><br>Please click the button above to get the Java plug-in now </applet> <!-- End: RealChat Client code --> <br><br> <small> Please wait for applet to load. </small> </center> </body> </html> <? } ?> |
#6
|
||||
|
||||
I told you to use $userinfo['age'], not $vbulletin->userinfo[birthday]
|
#7
|
|||
|
|||
The Age profile field is blank when I go into the chat room. I will post the code below so you can see exactly what I put instead of $vbulletin->userinfo[birthday]
<?php error_reporting(E_ALL & ~E_NOTICE); define('NO_REGISTER_GLOBALS', 1); chdir('/home/httpd/vhosts/url.com/httpdocs/bbs'); require('/home/httpd/vhosts/url.com/httpdocs/bbs/global.php'); include('/home/httpd/vhosts/url.com/httpdocs/bbs/global.php'); chdir('/home/httpd/vhosts/url.com/httpdocs'); $userinfo['birthday'] = $vbulletin->userinfo['birthday']; $userinfo['showbirthday'] = $vbulletin->userinfo['showbirthday']; // BIRTHDAY // Set birthday fields right here! if ($userinfo['birthday'] AND $userinfo['showbirthday'] > 0) { $bday = explode('-', $userinfo['birthday']); $year = vbdate('Y', TIMENOW, false, false); $month = vbdate('n', TIMENOW, false, false); $day = vbdate('j', TIMENOW, false, false); if ($year > $bday[2] AND $bday[2] != '0000') { $userinfo['age'] = $year - $bday[2]; if ($month < $bday[0] OR ($month == $bday[0] AND $day < $bday[1])) { $userinfo['age']--; } if ($userinfo['age'] > 101) { // why can't we have 102 year old forum users? $show['age'] = false; } else { $show['age'] = true; $show['extrainfo'] = true; } } if ($userinfo['showbirthday'] == 2) { if ($year > $bday[2] AND $bday[2] > 1901 AND $bday[2] != '0000') { require_once(DIR . '/includes/functions_misc.php'); $vbulletin->options['calformat1'] = mktimefix($vbulletin->options['calformat1'], $bday[2]); if ($bday[2] >= 1970) { $yearpass = $bday[2]; } else { // day of the week patterns repeat every 28 years, so // find the first year >= 1970 that has this pattern $yearpass = $bday[2] + 28 * ceil((1970 - $bday[2]) / 28); } $userinfo['birthday'] = vbdate($vbulletin->options['calformat1'], mktime(0, 0, 0, $bday[0], $bday[1], $yearpass), false, true, false); } else { // lets send a valid year as some PHP3 don't like year to be 0 $userinfo['birthday'] = vbdate($vbulletin->options['calformat2'], mktime(0, 0, 0, $bday[0], $bday[1], 1992), false, true, false); } if ($userinfo['birthday'] == '') { if ($bday[2] == '0000') { $userinfo['birthday'] = "$bday[0]-$bday[1]"; } else { $userinfo['birthday'] = "$bday[0]-$bday[1]-$bday[2]"; } } $show['extrainfo'] = true; $show['birthday'] = true; } else { $show['birthday'] = false; } } if (!in_array($vbulletin->userinfo['usergroupid'], array(5,6,7,9,10))){ ?> <!-- CSS Stylesheet --> <link rel="stylesheet" type="text/css" href="../bbs/clientscript/vbulletin_css/chatlogin.css" id="vbulletin_css" /> <br> <table class="tborder" cellpadding="3" cellspacing="1" border="0" width="70%" align="center"> <tr> <td class="panelsurround" align="center"> <div class="panel"> <div align="left"> <script type="text/javascript" src="../bbs/clientscript/vbulletin_md5.js"></script> <form action="../bbs/login.php" target="_top" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)"> <input type="hidden" name="do" value="login" /> <input type="hidden" name="url" value="../chat/chat.html" /> <input type="hidden" name="vb_login_md5password" /> <input type="hidden" name="vb_login_md5password_utf" /> <input type="hidden" name="s" value="" /> <!-- permission error message - user not logged in --> <div align="center" class="mediumfont"><b>To Enter the Chat Room</b></div> <br> <br> <div align="center" class="mediumfont">You must have a registered chat name to enter our chat rooms. If you have<br> not yet registered your chat name and would like to do so, please <a href="../bbs/register.php?do=signup" target="_top">click here.</a></div> <br> <br> <fieldset class="fieldset"> <legend>Log in</legend> <table cellpadding="0" cellspacing="2" border="0" align="center"> <tr> <td>Chat Name:<br /><input type="text" class="bginput" name="vb_login_username" size="50" accesskey="u" tabindex="1" /></td> </tr> <tr> <td>Password:<br /><input type="password" class="bginput" name="vb_login_password" size="50" accesskey="p" tabindex="1" /></td> </tr> <tr> <td> <span style="float:right"><a href="../bbs/login.php?do=lostpw" target="_top">Forgotten Your Password?</a></span> <label for="cb_cookieuser"><input type="checkbox" name="cookieuser" value="1" id="cb_cookieuser" tabindex="1" />Remember Me?</label> </td> </tr> <tr> <td align="right"> <input type="submit" class="button" value="Log in" accesskey="s" tabindex="1" /> <input type="reset" class="button" value="Reset Fields" accesskey="r" tabindex="1" /> </td> </tr> </table> </fieldset> </form> <!-- / permission error message - user not logged in --> </div> </div> </td> </tr> </table> <? }else { ?> <html> <head> <title>Chat Login Page</title> <link rel="stylesheet" href="styles.css" type="text/css"> </HEAD> <BODY LEFTMARGIN=0 RIGHTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 TOPMARGIN=0> <center> <!-- Begin: RealChat Client code --> <applet archive = "RealChat.jar" codebase = "." code = "rcs.client.RealChatClient.class" name = "ChatClient" width = "100%" height = "100%" align = "top" alt = "RealChat Client applet" MAYSCRIPT> <param name="nick" value="<?php echo $vbulletin->userinfo[username];?>"> <param name="embedded" value="yes"> <param name="channel" value="Room"> <param name="pLabel1" value="Gender:"> <param name="pValue1" value="<?php echo $vbulletin->userinfo[field14];?>"> <param name="pLabel2" value="Age:"> <param name="pValue2" value="<?php echo $vbulletin->userinfo[age];?>"> <param name="pLabel3" value="Location:"> <param name="pValue3" value="<?php echo $vbulletin->userinfo[field2];?>"> <param name="pLabel4" value=""> <param name="pValue4" value=""> <param name="pLabel5" value=""> <param name="pValue5" value=""> <param name="pLabel6" value=""> <param name="pValue6" value=""> <param name="pLabel7" value=""> <param name="pValue7" value=""> <param name="pLabel8" value=""> <param name="pValue8" value=""> <param name="onCloseURL" value="http://www.url.com/index.php"> <!-- no java or java disabled --> RealChat client requires Java compatible web browser<br>For more information visit our <a target="_blank" href="http://www.realchat.com/">java chat software</a> support page<br><br><a target="_blank" href="http://www.java.com/"><img src="getjava.gif" alt="Java - Get it now!" width="88" height="31" border="0"></a><br><br>Please click the button above to get the Java plug-in now </applet> <!-- End: RealChat Client code --> <br><br> <small> Please wait for applet to load. </small> </center> </body> </html> <? } ?> |
#8
|
||||
|
||||
T______T
dude, use $userinfo[age], and do not use $vbulletin->userinfo[age] $userifo and $vbulletin->userinfo is different. |
#9
|
|||
|
|||
Thank you so much. That worked.
BTW, I'm not a dude...I'm a girl :-) Thanks again...knew someone on here had to know how to do what I was trying to do. Jaime |
#10
|
||||
|
||||
glad that helped (finally ^^), girl.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|