How can I add a "Back to Search" link to user profiles? I have a view with exposed filters that allows users to search for other users on my site.  The view displays users' profile pictures, and clicking a profile picture takes one to the relevant user's profile (put together using Panels).

I'd like to display a "Back to search results" link on the user profile whenever someone clicks on the link (picture) in the view and visits the profile.  How might I go about doing this?

I'm using D7 with Panels and Views 3.
You can do this wih a new module modifying the user profile view.

// Implements hook_user_view().
function MY_MODULE_user_view($account, $view_mode, $langcode) {
  $account-&gt;content['link'] = array(
    '#weight' =&gt; -10,
    0 =&gt; array(
      '#markup' =&gt; '&lt;a href="/VIEW_URI"&gt;Back to Search&lt;/a&gt;',
    ),
  );
}


Note: When adding a hook always remember to clear caches

If you also want to preserve the filter that the user has applied you can do so within your filter in the view by selecting 'remember the last selection' and selecting the roles that you want this for.