kylephillips / favorites Goto Github PK
View Code? Open in Web Editor NEWSimple and flexible favorite buttons for any WordPress post type.
Home Page: https://favoriteposts.com
Simple and flexible favorite buttons for any WordPress post type.
Home Page: https://favoriteposts.com
Hi,
is there a way to get the post that a user just favorited, just right after the favorite button has been submitted?
The callback favorites_after_button_submit
is returning an array of all posts that a user has favorited so far, but it would be interesting to have a function that returns only the last one (and get if the user favorited or "unfavorited" it).
I need it to integrate the favorites activity in the Activity Feed of a BuddyPress site. Any other way to implement that would be also welcome.
Thanks!
Button is displaying for anonymous users even if the option is set not to.
Need to add a delete post action that loops through users, checks if the post has been favorited, and removes it from their favorites.
Check for HTML5 browser storage, and if it exists, use that before cookies/sessions. Fallback to cookie/session option
i'm integrating Favorites into my site at watchmecode.net and i'm loving it so far!
now i'm trying to build a little vanity metric on my WP Dashboard, to show me the total number of favorites added by all users, but I can't find a way to do this easily.
i could loop through all posts, call get_users_who_favorited_post
, loop through those and add +1 per favorite, but that's going to be a ton of processing and loops for a large list of posts / taxonomies.
it would be nice to have a get_all_favorites
or something like that, where i can get a list or count of all favorites in the system
thanks for the great plugin!
Add option to include the favorite count within the button text.
Include option to apply custom css class to button
Add post type and taxonomy parameters to list functionality, which would allow users to "filter" lists. See suggestion here:
https://wordpress.org/support/topic/suggestion-group-favorites-by-post-typetaxonomy?replies=2
Hi, when I activate the plugin, I get the following error in the debug.log:
PHP Fatal error: Class 'SimpleFavorites\Bootstrap' not found in /var/www/content/plugins/favorites/app/SimpleFavorites.php on line 20
There seems to be a strange problem with the autoloader, that I can't figure out. I tried to recreate the autoloader files with composer, but no luck so far.
Some users reporting the following:
Hi there,
it would be 100% helpful if you made it possible to remove single entries from a user’s favorites list - or clear it once and for all. That would make this plugin even more awesome 😉 .
What is the proper way to use the JavaScript callback functions?
You already have them defined in the minified JavaScript file. Are you wanting us to modify that file directly?
Also, the documentation here seems incorrect, where you reference "simple-locator", under "Callback Functions":
Hey, how i can add a limit of favorites by users ?
Add filter to the generated list, which will let devs format however they need to without a custom query. Will also solve AJAX problem.
Many users have requested the option of automatically including the button in generated lists.
I have a bug with plugin.
Here line of code which makes issue http://screencast.com/t/5Qj2K3zQn
Possibly add option of selecting ACF map field. See solution here for saving to simple locator geocode fields:
https://wordpress.org/support/topic/possible-to-search-distance-between-posts-user?replies=5
Unlike the [favorite_button]
-shortcode.
I would like to show the total favorite count for the current user at the top of the screen and use it as a link to their favorites overview page.
Whenever you add a new item to your favorites (using the favorite button), the favorite count is not updated. I guess this is also needed to make it work with caching turned on.
Add button to clear all favorites for the current user.
Hello,
Favorites works great for admin role but when i'm subscriber it doesn't work for example.
Thanks
passing a post type into any of the retrieval functions always displays ALL of the post ID's that have been favorited for that user.
I created a question on Stackoverflow
Thank You
I'm using a custom version of https://pippinsplugins.com/series/creating-a-user-follow-system-plugin/ for a project I'm working on now. WP Favorites would help me minimize code if I could add similar functionality for users. It's basically a "Follow" button like twitter/facebook. If I 'favorite' a user, I can then use a template tag or build a custom query to show latest posts/post_type of the authors I follow. Or anything for that matter.
My current system works well, just curious of the idea to add it to your amazing looking plugin.
Hi Kyle!
Thanks for #18!
I was just trying it on my dev machine, but it doesn't seems to be working on my install. I'm running multisite, with no caching enabled.
I am able to add posts to the favorites with the [favorite_button]
and get_user_favorites()
gives me the correct posts back.
Unfortunately [user_favorite_count]
always returns zero.
I looked at your code to see if I could fix it, but I failed. The get_user_favorites_count()
method in app/API/functions.php seems to be a bit messy compared to get_user_favorites()
. Perhaps it's still missing the multisite fix from 1.1.0?
Jeroen
Hi Friend, It is possible for a future update to set the expiration time of the cookie?
1 Month
No Expire
etc
/**
* Sync a Cookie Favorite
*/
public function cookie()
{
if ( $this->user->isFavorite($this->post_id, $this->site_id) ){
setcookie('simplefavorites', json_encode($this->removeFavorite()), time() + (86400 * 30), '/' );
return;
}
setcookie('simplefavorites', json_encode($this->addFavorite()), time() + (86400 * 30), '/' );
return;
}
Thanks
Look at adding a developer hook to the save action – specifically a way to attach custom information to saved favorites.
See: https://wordpress.org/support/topic/hook-to-add-info-to-bookmark?replies=2
Add settings link to plugin page
Need to inject favorites list on page load – same issue with page caching as button.
Also, can update list when a user favorites/unfavorites a post.
Probably need to provide an action for the indicator image so developers can customize (ex: gravity forms)
Need to replace lists on load via AJAX – similar issue with button states and page caching.
Basically instead of favoring a post the user adds it to a list (could be favorites, bookmarks, read later etc), maybe the user could create this "lists" (like youtube) or they are created by the admin.
Would this be viable at this point?
One feature request that would be really helpful… if a user has favorited a taxonomy (once taxonomy favoriting is in place), provide a way to filter queries by "favorites".
Add function & shortcode to display top favorited posts. Add limit parameter.
I think personally it would be an awesome idea if you could get the post thumbnail - this is just a suggest and would be pretty awesome.
Say you favourite a blog you can recognize that blog much easier if the thumbnail was there with it :)
SimpleFavorites\Bootstrap::startSession
slows down the page for almost 898 ms at index.php of the WordPress.
I haven't read the code yet, but I use cookie instead of session to store the metadata. I guess startSession
here means using session to store the metadata?
Please let me know if I can help with debugging.
Add WP repository screenshots for:
I'm working on a french translation and found:
If you are compiling your own minified Javascript, include the below (required for plugin functionality):
Depenedencies
favorites_after_button_submit(favorites, status) {}
Step 1: I read NONCE
http://www.web.com/wp-admin/admin-ajax.php?action=simplefavorites_nonce
Step 2: Send POST
http://www.web.com/wp-admin/admin-ajax.php?action=simplefavorites_favorite&nonce=a1f74g9cr1&postid=273&siteid=1&status=active
What am I doing wrong ?
thx
Hi @kylephillips ,
I don’t know how you best handle support requests/bug reports and the like & thought this might be a better place than the wp.org forums. So please excuse my double posting.
The problem I experience is simple: Your Plugin obviously needs to have all elements on a page to be loaded completely in order to fully function when using shortcodes and automatic placement of buttons. Latest version of WordPress and your plugin.
When I open a page or post, I can immediately see your Fav button. When I click on it while loading or even shortly after, the button changes to success message, takes a few seconds, then changes back to its unfavorited state, i.e. the page/post has not been added to my favourites. This is also reflected on the user’s fav count shortcode output I placed visibly. When I wait for a bit and then try to favorite my post, it works.
Chrome console throws out an error when fav adding fails:
Uncaught TypeError: Cannot read property 'length' of undefined
for simple-favorites.min.js in line 1.
Because you call your plugin wp-favorites
, the detail link on the plugin page loads the information of this plugin: https://wordpress.org/plugins/wp-favorites/, this confused me quite a bit, until I figured it out 😉
Add function/shortcode to list users who have liked a post. Include an array function and shortcode/list.
Will need to add in anonymous users.
Options:
Add template function to get user's total favorite count for a given blog/site.
See suggestion here:
https://wordpress.org/support/topic/personal-favorites-count-new-feature?replies=2#post-6845044
When using the shortcode [user_favorites] and a user who never had any favorites (so he has no "simplefavorites"-entry in the usermeta-table) visits the site you get the following Notice:
PHP Notice: Array to string conversion in /var/www/html/wordpress/wp-content/plugins/favorites/app/Entities/User/UserFavorites.php on line 117
If you set /var/www/html/wordpress/wp-content/plugins/favorites/app/Entities/User/UserRepository.php:91 from if ( empty($favorites) ) return array(array('site_id'=>1, 'posts' => array()));
to if ( empty($favorites) ) return array();
the Notice disappears
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.