kerrghann
03-03-2016, 04:52 PM
So I'm attempting to make a widget that greets my new members and encourages my veteran members to greet my new members. For some reason I get an error with my DB query, I'm sure it's a pretty simple fix and it's just error on my part but I can't seem to figure it out.
Here is my code:
$postcnt = vB::$vbulletin->userinfo['posts'];
$usrgrp = vB::$vbulletin->userinfo['usergroupid'];
$name = vB::$vbulletin->userinfo['username'];
$newmem = $vbulletin->db->query_first("SELECT username FROM " . TABLE_PREFIX . "user WHERE userid = $members[maxid] AND usergroupid NOT IN (3,4,8,17)");
$usid = $vbulletin->db->query_first("SELECT userid FROM " . TABLE_PREFIX . "user WHERE userid = $members[maxid] AND usergroupid NOT IN (3,4,8,17)");
if ($postcnt < 1 && $usrgrp == 2) {
$output = "<center>Welcome " . $name . ", you should introduce yourself -> <a href='http://rpgchat.com/forumdisplay.php/227-Welcome-Center'><font color='red'><u><b>Welcome Center</font></u></b></a></center>";
} else {
$output = "<center>Welcome Back " . $name . ", our newest member is " . $newmem . ", why not <a href='rpgchat.com/private.php?do=newpm&u='" . $usid . "'><u><b><font color='red'>Greet Them?</font></b></u></center></a>";
}
It pulls this lovely Error as well:
Fatal error: Call to a member function query_first() on a non-object in /*****/*****/public_html/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 4
I've look around, in fact I used this page (http://www.vbulletin.com/forum/forum/vbulletin-4/vbulletin-4-questions-problems-and-troubleshooting/404118-welcome-to-our-newest-member-info-line) to assist me in doing the query.
Any help would be immensely appreciated.
Thank you.
Here is my code:
$postcnt = vB::$vbulletin->userinfo['posts'];
$usrgrp = vB::$vbulletin->userinfo['usergroupid'];
$name = vB::$vbulletin->userinfo['username'];
$newmem = $vbulletin->db->query_first("SELECT username FROM " . TABLE_PREFIX . "user WHERE userid = $members[maxid] AND usergroupid NOT IN (3,4,8,17)");
$usid = $vbulletin->db->query_first("SELECT userid FROM " . TABLE_PREFIX . "user WHERE userid = $members[maxid] AND usergroupid NOT IN (3,4,8,17)");
if ($postcnt < 1 && $usrgrp == 2) {
$output = "<center>Welcome " . $name . ", you should introduce yourself -> <a href='http://rpgchat.com/forumdisplay.php/227-Welcome-Center'><font color='red'><u><b>Welcome Center</font></u></b></a></center>";
} else {
$output = "<center>Welcome Back " . $name . ", our newest member is " . $newmem . ", why not <a href='rpgchat.com/private.php?do=newpm&u='" . $usid . "'><u><b><font color='red'>Greet Them?</font></b></u></center></a>";
}
It pulls this lovely Error as well:
Fatal error: Call to a member function query_first() on a non-object in /*****/*****/public_html/packages/vbcms/widget/execphp.php(191) : eval()'d code on line 4
I've look around, in fact I used this page (http://www.vbulletin.com/forum/forum/vbulletin-4/vbulletin-4-questions-problems-and-troubleshooting/404118-welcome-to-our-newest-member-info-line) to assist me in doing the query.
Any help would be immensely appreciated.
Thank you.