It seems the hook_flag_validate() is called only after 2 Flag module validations.
imho, the hook should be invoked before any validation.

Ex. Change the permission message for unauthenticated user for a Flag : "Please login to flag it!".

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vasike’s picture

Status: Active » Needs review
FileSize
1.12 KB

and there is the patch.

joachim’s picture

We check the simple stuff first, before invoking a hook, for a number of reasons, one of which is performance. Also, it makes sense not to bug implementations of the hook with flagging attempts that don't even make sense (wrong bundle) or should not be allowed by permissions.

If you want to change that string so anonymous users are invited to log in, I'll consider an issue for that!

But this I think is a wontfix, sorry.

joachim’s picture

Title: Flag validation hook never invoked » invoke hook_flag_validate() before internal validation