AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

Filter by custom fields

Topic prefix

AI Assistant
Notifications
Clear all

[Solved] How to enable "liking" one's own post

5 Posts
2 Users
0 Reactions
1,648 Views
JorgeW
Posts: 107
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@jorgew)
Estimable Member
Joined: 7 years ago
[#9098]

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: 5774
 Sofy
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@sofy)
Support Team
Joined: 8 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.

image

JorgeW
Posts: 107
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@jorgew)
Estimable Member
Joined: 7 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.

No like icon nor capability

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

Support Team
Posts: 5774
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

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. 
image 1

JorgeW
Posts: 107
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@jorgew)
Estimable Member
Joined: 7 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: