The plugin allows site users to like and dislike any model, including blog posts, users, articles, or any other model. Just enter the path to your model namespace and provide the object ID.
Requirements
This plugin requires the Ajax Framework to be included in your layout / page in order to handle requests, and the RainLab.Users plugin must be installed and properly configured.
The following plugin is required
Rate a specific object
To configure the plugin for a specific record in the database, just connect the component and specify the model namespace and record ID. For example, the first user of the plugin RainLab.User
[LikeButton] likeable_type = "October\Rain\Auth\Models\User" likeable_id = 1
Rate a specific object from url
Let's say you have a page "/users/:id". To configure the plugin in such a way as to rate the user this page belongs to, you need to set the likeable_id so that it corresponds to the id variable
[LikeButton] likeable_type = "October\Rain\Auth\Models\User" likeable_id = "{{ :id }}"
Likes in list
Alternatively, you can pass the object ID directly to the component. This is useful, for example, when listing objects. Let's say you are listing posts. In this case, just connect the component, specify the model, and pass the ID when listing.
[LikeButton] likeable_type = "October\Rain\Auth\Models\User" likeable_id = "1"
{% for user in users %} {% component 'LikeButton' likeable_id=user.id %} {% endfor %}
-
Snipi
Found the plugin useful on 31 Aug, 2021
One question... how to get info, about if current user "voted"?
-
1.0.2 |
Created table xl1034_likes_index Feb 25, 2021 |
---|---|
1.0.1 |
Initialize plugin. Feb 25, 2021 |