• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Not planned Dynamically manipulate the like list

imthebest

Well-known member
#1
I'm migrating from a vB 3.8 forum where I was using the Post Thank You hack and adapted it to work as a like system. Even when I had restricted it's usage for new members, there were still trolls who patiently waited until reaching the post number restriction and start like-spamming official posts like announcements and so. I asked a programmer about that and he got a workaround to exclude banned members from the like list (the likes are still there, we're just hiding them from the list).

I have asked a programmer here to port that add-on to work with xF 1.3 but I was told:

In your add-on example from VB you are grabbing the likes from the database, but in XF the user ID's are stored as a string inside each post and therefore cannot be dynamically manipulated.
So my suggestion is to not store the userids of the members who liked a message as a string so they can be dynamically manipulated to easily achieve things like, well, filtering banned members from the like list.
 

Mike

XenForo developer
Staff member
#2
You can obviously choose to make it behave differently for your specific needs, but removing this would potentially be a significant performance penalty. If you want to add an additional layer, there's nothing to prevent you from changing the likes list dynamically and you'd be in the same position as if the cache didn't exist.
 

imthebest

Well-known member
#3
Hi @Mike but it looks like there is no easy way to exclude (hide, filter) the banned members from the like list of a post. Here is what the programmer said:

If you want to simply not display the likes from banned users, then you could compare the likes inside each post to a list of banned members when the post is processed, however unless you cache the list of banned members then that would be one additional query for each and every post. So the only way I see to achieve this is to cache a list of banned members but that is overkill if you have many.
I'll display 20 posts per thread page, is there another easy way to hide banned members from the like list of each post without adding one additional query for each post?
 

W1zzard

Well-known member
#4
Create an extra database field for your customized likes data and hook into the datamanager to update your field and set it to whatever you like.
 

Mike

XenForo developer
Staff member
#5
You said your previous version was pulling from the DB rather than being cached. Simply ignore the cache and access the data that you want with the method that you want and you'll be equivalent.

Regardless, the query per post is the exact reason this is "No Thanks".
 

Chris D

XenForo developer
Staff member
#6
It seems you have another developer in mind, which is fine because I've got a lot on at the moment, but the solution I gave to you would likely be the most feasible.
I'm not sure how feasible this one is. The only way I think it would be possible is to remove likes from the database completely when a member is banned. That wouldn't be a difficult task.
I've since thought it through a bit more and it may be more difficult than I originally conveyed, but really it's the only plausible way without ruining performance as Mike has suggested.