Hi i am new to drupal and i am creating community website in i use buddylist module and i need to have some changes when person add the buddy or delet i want the user return back to the page he was viewing bcz i am using the snippet which show [+] to add [-] to delet and its use in diffrent pages where user name is found here is the defualt code where return is to user profile page i want user back on the page he was viewing.

thanxs and your help is appriceated

function buddylist_addbuddy_submit($form_id, $form_values) {
  if (variable_get('buddylist_require_approval', 0)) {
    buddylist_add_request($form_values['uid']);
  }
  else {
    buddylist_add($form_values['uid']);
    drupal_set_message(t('%name will be be notified the next time s/he logs in.', array('%name' => 

$form_values['name'])));
  }
  return  'user';
};

Comments

dldege’s picture

You should be able to do this with drupal_get_destination() which will add in a url query parameter that will override the default behavior of the form submit and return you to the page you set.