I noticed that when accessing as anonymous user the function

function flag_friend_preprocess_author_pane(&$variables) {
  global $user;
  $account_id = $variables['account']->uid;
  $image_path = $variables['image_path'];

  // Accessing the user profile is the only way to be able to see the friend
  // flag out-of-the-box so I feel it's pretty safe to use this permisssion.
  if ($account_id != 0 && user_access('access user profiles') && $user->uid != $account_id) {
     [...]

Just checks if the user owner of the Pane is registered.
This performs unnecessary queries when rendering pages to anonymous users.

This should be:

  // Accessing the user profile is the only way to be able to see the friend
  // flag out-of-the-box so I feel it's pretty safe to use this permission.
  if ($account_id != 0 && $user->uid != 0 && user_access('access user profiles') && $user->uid != $account_id) {
    [...]

Comments

sirkitree’s picture

Status: Active » Fixed

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