There's a lot more hook_user ops than 'categories', 'register', "validate", 'view' and it looks like it's only relative for 'view', it runs fasttoggle_user on every op but 'categories', 'register', "validate" (update, after update, insert)

Also !empty > array_key_exists performance wise tmk and using $user as a local variable name is bad coding standards wise

Untested

CommentFileSizeAuthor
fasttogle_hook_user.patch1.51 KBhefox

Comments

nigelcunningham’s picture

Thanks for the patches.

How about just

  if ($op !== 'view') {
    return;
  }

(Will minimise the diff to that and the array_key_exists => empty change).

hefox’s picture

The diff also accounts for $type => $op and $user => $account change, and lower down where - if ($type == "view" && !empty($links)) { would need to change also.

imo it's usually better to do if $op == something instead of != return as it cleaner later on when needing to add a condition that uses a different $op, however I personally don't feel strongly about it either way.

nigelcunningham’s picture

Status: Needs review » Fixed

Ta, once again!

Status: Fixed » Closed (fixed)

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