hook action to points update
-
I would like have an action that upon an update to the mycred_default_total to check the balance and carry out action if the balance is greater than x or y.
so that in effect on each award of mycred points :
$balance = get_user_meta( $user_id, 'mycred_default_total', true ); if ($balance>249) update_user_meta( $user_id, 'private_group', 'group1');
I can code the action, but am struggling as to where to hook it to or put it.
Do you have any natural hooks, the best place I could see would be
function mycred_update_user_meta in mycred-functions, as presumably apart from the initial creation, this is the function called whenever the balance is updated?I would therefore have 3 choices
1. Copy the mycred_update_user_meta function to my functions file, and add the actions within that. I presume that since the theme’s function file would be called first, then this would work as you function would not load – but your advice would be welcome.
2. Change the core function in your plugin and note to need to change it whenever update occur – less than optimum
3. The solution you will now post, which is much better than the two above ?
Thanks for your help
- The topic ‘hook action to points update’ is closed to new replies.