There was a big discussion recently on a forum I administrate about whether or not Likes should be removed. Half want them gone, the other half want them to remain. I’ve found the theme component that hides the ability to like a post for TL0 and anonymous users, and I’ve mostly adapted this for our use, however, I’m not sure how to link it up with a user field boolean I’ve created (“toggle likes”). In the original theme component, it uses something like “settings.hide_for_anon_user” and it creates a theme setting in settings.yml called “hide_for_anon_user” but that can only be toggled by an administrator and not on a user level.
How would I go about referencing the custom field for this? I’ve already added it to public_user_custom_fields, I just don’t know how to go about referencing it in the component JS file. I’ve tried userCustomFields.user_field_10, settings.current_user.custom_fields.user_field_10, and current_user.custom_fields.user_field_10, but none of them work, they just hide all of the posts in a thread.
How do I reference the group in this case, though?
I replaced
this.currentUser.trust_level === 0;
with
this.currentUser.no_likes;
but it didn’t work. Again, not sure how to reference custom groups, much like user fields, it doesn’t appear to be clearly stated in any documentation.
But I’d still like to see if there’s a way to do this so it checks the custom user field boolean instead of making people join a group. I’ve been looking through other plugins to get an idea of how to do that, but everything I’ve tried so far hasn’t worked.
ETA: This seems to work, but you need to refresh after checking or unchecking the userfield boolean.