Breaking out this issue from a separate thread.
The issue here is if more than one action is possible between users, each iteration through the below array will overwrite the previous, resulting in just one link for relationship actions, regardless of how many there are, when visiting another user's page under the 'Profile image and action links' block.
$actions = _user_relationships_ui_actions_between($user, $account);
foreach ($actions as $key => $action) {
$links["ur_action"] = array(
'title' => $action . 'action',
// No href because this is the best that UR can offer
'html' => TRUE,
);
}This patch, logic provided here: http://drupal.org/node/1244998#comment-5020824, fixes that, since the $links array is passed through the theme_links function. Therefore instead of overwriting, we create a separate array for each link (e.g. $links['ur_action_0'] = array('title' => 'some linked title', 'html' => TRUE); $links['ur_action_1'] = array('title' => 'some other linked title', 'html' => TRUE);).
Resulting patched code below:
$actions = _user_relationships_ui_actions_between($user, $account);
foreach ($actions as $key => $action) {
$links["ur_action_$key"] = array(
'title' => $action,
// No href because this is the best that UR can offer
'html' => TRUE,
);
}| Comment | File | Size | Author |
|---|---|---|---|
| ur_action_links_fix-1244998-6.patch | 846 bytes | chrisarusso |
Comments
Comment #1
isellakuria commentedThanks for your patch, I have tried it and now two links are displayed below the user picture: "follow" and "unfollow". If I press "follow" both users can see their respective user updates like in twitter. However now I see two "unfollow" links below the user's picture.
Comment #2
isellakuria commentedI think I found a temporary solution to my problem, I'm posting the modified code, I tested it rapidly and it works even if I think it should not be the final solution:
I basically added a condition for when there is just more than one action and if so I remove the last item of the array ("unfollow") that is the one that was originating the problem initially. Only one action is passed to the $links array every time.
Comment #3
ezra-g commentedThanks very much for the patch here - I apologize that it didn't get a proper review. An equivalent fix to this hunk of code was made in the commit for #1244998: User relationships not working as expected (version 2).
Thanks!