Notifications
Clear all

wpForo 1.x.x [Solved] How to enable "liking" one's own post

5 Posts
2 Users
0 Likes
765 Views
JorgeW
Posts: 68
Topic starter
(@jorgew)
Trusted Member
Joined: 3 years ago

Hi Support,

The way we are using wpForo needs that in the threaded layout I -as the one who is posting- could "like" my own post.

Is there a way to enable liking one's own post (topic or reply)?

Thanks.

4 Replies
Sofy
Posts: 4057
 Sofy
Admin
(@sofy)
Support Team
Joined: 5 years ago

Hi @jorgew,

I'm really sorry, but there is no option that'll allow users to like their own posts.

Please follow the steps: 

  1. Find the buttons function in wp-content/plugins/wpforo/wpf-includes/class-template.php file
  2. Scroll to like case
  3. Remove the following part as shown in the screenshot below.
    && WPF()->current_userid != $post['userid']

Important: those changes will be overwritten during the upgrade process and customizations will be lost.

JorgeW
Posts: 68
Topic starter
(@jorgew)
Trusted Member
Joined: 3 years ago

Hi @sofy,

It works, perfectly, but only in extended layout (where I don't need it), not in the threaded one, which is the layout where I need it.

This is the current code I'm using (without what you indicated):

case 'like':

if( WPF()->perm->forum_can('l', $forumid) && $login ) {

$like_status = ( WPF()->post->is_liked( $postid, WPF()->current_userid ) === FALSE ? 'wpforo-like' : 'wpforo-unlike' );

$like_icon = ( $like_status == 'wpforo-like') ? 'up' : 'down';

$button_html[] = '<span class="wpf-action '. $like_status .'" data-postid="'. wpforo_bigintval($postid) .'"><i class="fas fa-thumbs-'. esc_attr($like_icon) .' wpfsx wpforo-like-ico"></i><span class="wpforo-like-txt">' . wpforo_phrase( str_replace('wpforo-', '', $like_status), false) . '</span></span>';

}

break;

Icon will not not show up in threaded layout.

1 Reply
Sofy
 Sofy
Admin
(@sofy)
Joined: 5 years ago

Support Team
Posts: 4057

Hi @jorgew,

  • open the wp-content/plugins/wpforo/wpf-includes/functions-template.php file. 
  • find the wpforo_like_button() function.
  • removed the code shown on the screenshot. 
JorgeW
Posts: 68
Topic starter
(@jorgew)
Trusted Member
Joined: 3 years ago

Yes @sofy, it works!!!

Thank you sooooooo much!

And thanks for your always present willingness to help, and for your generosity too!!  🙂 🙂

Share: