PDA

View Full Version : Add Friend Button


wh1t3dr3am
01-20-2011, 01:05 PM
How to make add friend button in red mark ?but if already has been friend it will not show button.
Any advice for this ? Thx :D

http://img213.imageshack.us/img213/6562/testhr.jpg

wh1t3dr3am
01-23-2011, 01:33 PM
go up :D

MichelangeloITA
01-23-2011, 02:21 PM
Yes, that's cool dude, I need this too :)

It should be default :D

wh1t3dr3am
01-24-2011, 02:09 PM
Thx :D

I hope someone can tell me how to make add friend button :)

Yellow Slider
01-24-2011, 04:15 PM
Create a new plugin using the hook location postbit_display_complete.


$postuserinfo = fetch_userinfo($post['userid'], 128);
$isfriend = $postuserinfo['isfriend'];
if (!$isfriend)
{
$template_hook['postbit_userinfo_right'] .= '<a href="profile.php? ' . $vbulletin->session->vars['sessionurl'] . 'do=addlist&amp;userlist=friend&amp;u=' . $post['userid'] . '">' . construct_phrase($vbphrase['befriend_x'], $post['username']) . '</a>';
}

MichelangeloITA
01-25-2011, 03:42 PM
Create a new plugin using the hook location postbit_display_complete.


$postuserinfo = fetch_userinfo($post['userid'], 128);
$isfriend = $postuserinfo['isfriend'];
if (!$isfriend)
{
$template_hook['postbit_userinfo_right'] .= '<a href="profile.php? ' . $vbulletin->session->vars['sessionurl'] . 'do=addlist&amp;userlist=friend&amp;u=' . $post['userid'] . '">' . construct_phrase($vbphrase['befriend_x'], $post['username']) . '</a>';
}


Not working ob vB4.1.1 :(

My settings here

http://img148.imageshack.us/img148/1821/immaginevq.png

Lynne
01-25-2011, 04:49 PM
The original works fine for me (yours won't work since you have <ahref instead of <a href). Needs a bit of styling (CSS) but it shows up when it should. It's just text right now, not a button.

wh1t3dr3am
01-25-2011, 04:54 PM
Thank You Very Very Much Yellow Slider :D
Working on VB PL 4.1.0 Patch lvl 2 :)

But can you give me some advice for how to change text "befriend" to image ? :D

Yellow Slider
01-25-2011, 09:17 PM
Thank You Very Very Much Yellow Slider :D
Working on VB PL 4.1.0 Patch lvl 2 :)

But can you give me some advice for how to change text "befriend" to image ? :D

Sure.

$postuserinfo = fetch_userinfo($post['userid'], 128);
$isfriend = $postuserinfo['isfriend'];
if (!$isfriend)
{
$template_hook['postbit_userinfo_right'] .= '<a href="profile.php? ' . $vbulletin->session->vars['sessionurl'] . 'do=addlist&amp;userlist=friend&amp;u=' . $post['userid'] . '"><img src="YOUR IMAGE" alt="" border="0" /></a>';
}

wh1t3dr3am
01-26-2011, 03:12 PM
Not Success :)
Edit :
1.Why if i has been add people still show image for add friend ?

2.why Image add friend show to post you create ?

sry,if i can't speak english very well :)
Thx :D

Yellow Slider
01-26-2011, 07:44 PM
Not Success :)
Edit :
1.Why if i has been add people still show image for add friend ?

2.why Image add friend show to post you create ?

sry,if i can't speak english very well :)
Thx :D

Because you are not considered a friend of a user until he officially accepts your friendship request.
This is the fix the first issue:

if ($post['userid'] != $vbulletin->userinfo['userid'])
{
$postuserinfo = fetch_userinfo($post['userid'], 128);
$isfriend = $postuserinfo['isfriend'];
if (!$isfriend)
{
$template_hook['postbit_userinfo_right'] .= '<a href="profile.php? ' . $vbulletin->session->vars['sessionurl'] . 'do=addlist&amp;userlist=friend&amp;u=' . $post['userid'] . '"><img src="YOUR IMAGE" alt="" border="0" /></a>';
}
}

MichelangeloITA
01-26-2011, 09:51 PM
Thank's man, you rock :D

wh1t3dr3am
01-28-2011, 05:05 PM
Good Job,Success :D Thx for your advice :)
Awesome....

ja.halliburton
03-09-2012, 02:09 AM
I put in ur code but all Im getting is a torn box without an image , do you know what else I must do?

Easy5s.net
05-11-2012, 12:33 AM
Create a new plugin using the hook location postbit_display_complete.


$postuserinfo = fetch_userinfo($post['userid'], 128);
$isfriend = $postuserinfo['isfriend'];
if (!$isfriend)
{
$template_hook['postbit_userinfo_right'] .= '<a href="profile.php? ' . $vbulletin->session->vars['sessionurl'] . 'do=addlist&amp;userlist=friend&amp;u=' . $post['userid'] . '">' . construct_phrase($vbphrase['befriend_x'], $post['username']) . '</a>';
}


$postuserinfo = fetch_userinfo($post['userid'], 128); 128 what is?

Lynne
05-11-2012, 01:06 AM
See the API for the function here - http://members.vbulletin.com/api/

Values for Option parameter:

.....

128 - Is the logged in User a friend of this person?