-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add storage of favourited statuses #63
base: main
Are you sure you want to change the base?
Conversation
09038e7
to
c451222
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see how this makes sense as a small scale implementation but I do think we should go the extra mile and implement it with a taxonomy.
If Friends plugin is installed, it already stores reactions as terms and getting the favourite count should be done by querying the taxonomy.
I'd also like to use this approach versus storing serialized post ids (what if you delete posts, etc.).
I could see that we add filters so that as a quick win you could get this small scale implementation that works for you by using another plugin or a code snippet.
Makes sense, deleting a post isn't a big deal as it just won't be returned during the favourites list generation, but it does hang around in the array, so yeah, not the best. I'll add some filters to it and push an update tomorrow. |
Thank you! |
02ae589
to
99c5ad1
Compare
I've been thinking about this a bit more and took a look at how Friends does the reactions, Friends uses a non-hierarchical taxonomy to do the storage, so you're creating one taxa for each user/action. I'm not an expert on taxa, but would it be possible instead to use a hierarchical taxa so that it could be something like:
And then for bookmarks:
The other question I had was around the following of hashtags... I don't think you can have a taxa of a taxa right? Aka you can't add a |
99c5ad1
to
77ccdad
Compare
101b91a
to
403f699
Compare
@akirk I've converted to terms for this PR, however I've left the favourite count as a post_meta, as there seems to be no easy way to count terms over multiple taxonomies (aka no wildcards allowed in taxonomy terms in tax_queries). That only leaves two options, creating one tax_subquery for each user (not a very nice/scaleable solution), or a custom SQL query. Neither are pleasant and for a simple count, the post_meta is probably lighter and more scaleable anyway. |
Just for reference, here's the SQL required to do the count:
|
79a8dc3
to
c855fc2
Compare
Store and retrieve favourite statuses.
c855fc2
to
d876f33
Compare
Use user/post meta to store favourited statuses.