MyBB Community Forums

Full Version: Add New Buddy from Post [1.2 - 1.4]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello, i would like to show you a simple way to add a new buddy from every post or from there profile

Version: 1.2.* - 1.4.*
Credits: CraKteR, + Me

[Image: 37779383gm1.jpg]
download this plugin. Credits to Crakter. Not updated since 2006 but it works perfectly with 1.4.* and other versions. http://mods.mybboard.net/download/quick-buddylist-1.0

1) Upload buddylist.php to your inc/plugins directory.

2) Go and activate the plug-in in your admin CP -> Plugin Manager -> Quick buddylist
3) check someones profile on your forum to see if there is a link to add to buddy list

once you have done this. to get quick add buddy in postbit.
1. click templates & styles in your admin CP
2. on the left hand side menu click templates
3. choose your theme templates, click "options" then click Expand Templates
4. scroll down until you find "Post Bit Templates" click "expand"
5. click "full edit" on postbit
6.find {$post['onlinestatus']}
7. between {$post['onlinestatus']} and </br> add
<a href="usercp.php?action=quickaddbuddy&uid={$post['uid']}"><img src="http://www.yourdomain.com/images/user_add.png"/></a>
8. click save.

go to this image.
http://www.movie-247.net/images/user_add.png
save this image. then upload to your "images" directory

done Smile
Credits to: Crakter for the Add buddy in Profile plugin
Me for guiding you for this Big Grin
no-one found this useful? Sad

i would have thought it was useful
This modification itself would be useful if the buddy list was useful.
Usefull, thank you!
Well the buddy list thing is of some use if it's a real large forum as it's hard to keep track on the username at times, so members can simply add their fav. members to their list and quickly drop them a PM etc.
I needed a ignore button, and starting form your idea I was able to rewrite the plugin to suite me. Thank you very much.
(2008-10-30, 11:02 PM)thor2705 Wrote: [ -> ]I needed a ignore button, and starting form your idea I was able to rewrite the plugin to suite me. Thank you very much.

Now this is a good idea. Mind sharing?
(2008-10-31, 12:40 AM)Bey Brad Wrote: [ -> ]
(2008-10-30, 11:02 PM)thor2705 Wrote: [ -> ]I needed a ignore button, and starting form your idea I was able to rewrite the plugin to suite me. Thank you very much.

Now this is a good idea. Mind sharing?
No, no problem. I will put the code here:
<?php
/**
 * Copyright © 2008.
 */
if(!defined("IN_MYBB")) {
    die("This file cannot be accessed directly.");
}

$plugins->add_hook("usercp_start", "ignorelist_run", 100000);

function ignorelist_info() {
	return array(
		'name'			=> 'Quick Ignorelist',
		'description'	=> '',
		'website'		=> 'http://www.mcdcpp.net',
		'author'		=> 'CraKteR modified by Thor2705',
		'authorsite'	=> 'mailto:[email protected]',
		'version'		=> '0.1'
	);
}

function ignorelist_activate() {
	require MYBB_ROOT."/inc/adminfunctions_templates.php";
	find_replace_templatesets("member_profile", '#{\$memprofile\[\'msn\'\]}(.*?)</tr>#ism', "{\$memprofile['msn']}\\1</tr>\n<tr id=\"ignore\">
	<td class=\"trow1\"><strong>Ignore List</strong></td>
	<td class=\"trow1\"><a href=\"usercp.php?action=quickaddignore&uid={\$memprofile['uid']}\">Add to Ignore List</a></td>
</tr>");
}

function ignorelist_deactivate() {
	require MYBB_ROOT."/inc/adminfunctions_templates.php";
	find_replace_templatesets("member_profile", '#(\n?)(\r?)<tr id\=\"ignore\">(.*?)</tr>(\n?)(\r?)#ism', "", 0);
}

function ignorelist_run() {
	global $db, $mybb, $lang;
	if($mybb->input['action'] == "quickaddignore") {
		if($mybb->input['uid'] == 0) {
			return;
		}
		if($mybb->input['uid'] == $mybb->user['uid']) {
			error("You have failed to add yourself to your own ignore list.", "Errr. What happend?");
		}
		$query = $db->query("SELECT ignorelist FROM ".TABLE_PREFIX."users WHERE uid='".$mybb->user['uid']."'");
		$list = $db->fetch_field($query, 'ignorelist');
		if(strpos($list, ",") || strlen($list > 0)) {
			$newlist = $list.",".intval($mybb->input['uid']);
		} else {
			$newlist = intval($mybb->input['uid']);
		} 
		$db->query("UPDATE ".TABLE_PREFIX."users SET ignorelist='".$db->escape_string($newlist)."' WHERE uid=".intval($mybb->user['uid'])); 
		redirect("usercp.php?action=editlists", $lang->redirect_ignoreupdated);
	}
}
?>
You save this as ignorelist.php
Modification in templates:
go to your template and find post bit templates, expand it and search for postbit and postbit_classic you add the same code in both of them:
<td align="right"><a href="usercp.php?action=quickaddignore&uid={$post['uid']}"><img src="http://location of your image/images/p_ignore.gif"/></a>
Change "location of your image" with the path to your image.
and also you have to upload a ignore image, you can copy mine or you can find something different.
the place where you insert the code in the template depend on where you want the image to show up, I am using it in the same place with "replay" and...
Enjoy!
Sorry I forgot the link to the button:
http://www.romaniincanada.org/forum/images/p_ignore.gif
Useful plugin, thanks.

Cheers,
Gene
Is there any way that someone can edit the code so that it will not display the add buddy icon on my own account.
Pages: 1 2