MyBB Community Forums

Full Version: Add to Buddy List
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I tried to implement the mod of Add to Buddy List in post bit but got the following error:

mySQL error: 1146
Table 'chiefsaab_forum.users' doesn't exist
Query: UPDATE users SET buddylist='2' WHERE uid='4'


I know this hasn't been updated for RC4. Lets wait for MM. Another thing, can we also use this mod on user profile page? Please Smile
try this:

Find:
} else {
    // Get posts per day
    $daysreg = (time() - $mybbuser['regdate']) / (24*3600);
    $perday = $mybbuser['postnum'] / $daysreg;
    $perday = round($perday, 2);
After add:
} elseif($action == "quickaddbuddy") {
    if($uid == $mybb['uid'])
    {
        error($settings['bbname'], "You cannot add yourself to your own buddy list.");
    }
    $query = $db->query("SELECT buddylist FROM ".TABLE_PREFIX."users WHERE uid='$mybb[uid]'");
    $list = $db->fetch_array($query);
    if(strpos($list['buddylist'], ",") || strlen($list['buddylist'] > 0))
    {
        $newlist = $list['buddylist'].",$uid";
    }
    else
    {
        $newlist = $uid;
    }
    $query = $db->query("UPDATE ".TABLE_PREFIX."users SET buddylist='$newlist' WHERE uid='$mybb[uid]'");
    eval("\\$message = \\"".$templates->get("redirect_buddyupdated")."\\";");
    redirect($settings['bbname'], $message, "usercp.php?action=editlists");
Then:
Quote:ACP -> Templates -> Modify / Delete -> *Template Set Name* -> Post Bit -> Expand -> postbit -> Edit
Find:
Quote:Status: $onlinestatus$replink<br />
After add:
Quote:<a href="usercp.php?action=quickaddbuddy&uid=$post[uid]">Add to Buddy List</a>
Actually k776, the block of code you pasted has to go before this one...

} else {
	// Get posts per day
	$daysreg = (time() - $mybbuser['regdate']) / (24*3600);
	$perday = $mybbuser['postnum'] / $daysreg;
	$perday = round($perday, 2);

...not after. Either way though, there are still a couple of bugs in your code, but the tutorial has now been updated for RC4 and all little bugs have been fixed.

Cheifsaab, I recommend you reinstall the tutorial using the updated code: http://www.mybbmods.com/tutorials.php?action=view&tid=9.

Also, if you want to add the link to your user profile pages, open up the member_profile_customfields template, look for $customfields and add this block of HTML below it...

<tr><td colspan="2" class="$bgcolor" align="center"><span class="smalltext"><a href="usercp.php?action=quickaddbuddy&uid=$uid">Add to Buddy List</a></span></td></tr>
and you can also add it to member list:

http://www.mybbmods.com/forum/showthread.php?tid=182
Thanx MM, it's working Smile