I have created custom user-profile.tpl.php and I´d like to put custom " "Add to friends" button into it. Is there some solution (php snippet) for this?

thanks for great module

Comments

sandino’s picture

Same problem, subscribe.

vewakayeh’s picture

Version: 6.x-1.0-rc4 » 6.x-1.0-rc5

Same problem, subscribe.

mogop’s picture

subscribe

Donaldd’s picture

Subscribing, I need this also.

dabeast’s picture

subscribing

mrf’s picture

You can manually provide these links with two important pieces of information, the uid of the user you are 'friending' and the relationships type id.

The hardest part of this is finding the id of the user you are currently looking at and want to friend, you can provide this as a hidden field in a view, or do a lookup through php, but it really is dependent on where you are looking for the information from.

The relationship id can be found on user management->relationships->list and hovering over the edit button for the relationship will show you the id in the url.

You can then build out a link using the following format:
http://example.com/relationship/%userid/request/%relationshipid
So for user 8 and relationship 2 you'd have:
http://example.com/relationship/8/request/2

mrf’s picture

Status: Active » Fixed

Setting to fixed, switch it back if you are still having problems.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Heihachi88’s picture

Status: Closed (fixed) » Needs work

How to hide this link if u're already friend with this user?

Heihachi88’s picture

Priority: Normal » Major
mrf’s picture

Status: Needs work » Fixed

Have a look at #420714: "add to contacts" link and hide profile fields if not in relationship you could wrap your links in a similar if condition that uses user_relationships_load

Status: Fixed » Closed (fixed)
Issue tags: -php print, -relationship button, -custom user profile

Automatically closed -- issue fixed for 2 weeks with no activity.