i'm using

function mymodulename_flag_validate($action, $flag, $entity_id, $account, $skip_permission_check, $flagging) { 
kpr('asdasda');
} 

in my module. but i don't see any output when i click a flag/unflag link. so i think the hook never gets called.
or am i doing something wrong?

Comments

joachim’s picture

Category: support » bug
Status: Active » Postponed (maintainer needs more info)

You probably won't see any output via drupal messaging or print_r because it's AJAX.

Try using watchdog instead.

sheena_d’s picture

I'm experiencing the same issue with hook_flag and hook_unflag. I called watchdog() in these hooks and saw no log entries were made. I also switched the flag type to work as a normal link and drupal_set_message() did not return a system message.

Using 7.x-3.0-rc1

joachim’s picture

Did you clear your cache after adding those hooks?

sheena_d’s picture

Yes, many times.

joachim’s picture

Can you watchdog() at the point the hook is invoked?

sheena_d’s picture

Actually, I realized that I had read the hook name wrong, it's hook_flag_flag, not hook_flag. My brain removed the redundancy for me, how convenient. Sorry!