Is there a way to rout the user to a different page after adding someone to the buddylist? i am using a php snippet on each userprofile, (I am using the usernode, nodeprofile, and node family modules)

 if ($GLOBALS['user']->uid != $user->uid) :

if (@in_array($user->uid, array_keys(buddylist_get_buddies($account->uid))) && user_access('maintain buddy list'))
{
  print l('remove '.$user->name . ' from your buddylist', 'buddy/delete/'. $user->uid); 
  }
else {
  if ($user->uid != $account->uid && user_access('maintain buddy list')) {
  print l('add '.$user->name.' to your buddylist', 'buddy/add/'. $user->uid);
  }
}
 endif; 

that i got from the snippets page.
problem is, when the user adds someone to his/her buddylist, it takes them back to their own account page. i want the user to be routed back to the node from which they came - which would be the userprofile of the user they were viewing when they chose to add the to the buddylist

any way i can do this?

j

Comments

fago’s picture

Status: Active » Fixed

you just need to pass another paramter to the l() function, which generates the links for you.

e.g. try:
l('remove '.$user->name . ' from your buddylist', 'buddy/delete/'. $user->uid, array(), drupal_get_destination());

Anonymous’s picture

Status: Fixed » Closed (fixed)