kylephillips / favorites

Simple and flexible favorite buttons for any WordPress post type.
https://favoriteposts.com
223 stars 86 forks source link

Feature request: hooks #158

Open leorospo opened 2 years ago

leorospo commented 2 years ago

Hey there @kylephillips ! Great plugin BTW, i really liked how it was designed with developers in mind. It is very handy to have multiple shortcodes, functions & filters I was wondering if you are thinking to add or publish any hook

For example it would be intresting to be able to do something like this:

<?php

add_action(  'added_to_favorites',  'do_something' );
function do_something($post_id) {

    # Fires when the user adds a post to his favorites

    /* Do something: 
        - Award points via other plugin
        - Interact with the favorited post or post_meta
        - Set user intrests from the post_meta
        - Take action on the user himself
     */

};

I think it would be a great addition to the plugin & would further boost developers' flexibility

Here some more that come to my mind:

hook Fires when
added_to_favorites Fires when the user adds a post to his favorites
removed_from_favorites Fires when the user removesa post from his favorites
favorites_changed Fires whenever the user adds or removes a post from his favorites
favorites_emptied Fires whenever the user empties his favorites
charnesk commented 1 year ago

@leorospo Did you end up doing your own version of this idea? I was looking for the same hook...

leorospo commented 1 year ago

hi @charnesk I'm sorry but i did not follow up on that. Maybe if enough attention in brought to the feature it will be implemented.