-
Author
Tagged: buddypress, likes
-
September 21, 2015 at 15:13 #78697efullmanParticipant
Hi,
I was hoping to add the kleo likes item to Buddypress Activity. (<?php get_template_part( ‘page-parts/posts-social-share-small’ ); ?>)
I would love to stick it in the entry loop. I can get it to show, but it shows every activity with the same number of likes. I don’t think it’s getting a post-id it can use.
Any thoughts.
Thanks.
September 21, 2015 at 20:04 #78788RaduModeratorHi,
Unfortunately this is not possible but i recommend you to test this plugin : https://wordpress.org/plugins/buddypress-like/
Regards
Radu
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 21, 2015 at 21:18 #78814efullmanParticipantRadu,
I tried that plugin, and it just came up with a white screen.
Looking through the Items-Like.php code it seems like you could get it to stop looking at the Post_id and repurpose it to look at bp_activity_id() and install the call for post-social-share.php in the entry.php file as the activity loop calls it to iterate, I was thinking that it would know the post_id. I guess the challenge might be clicking on the heart, and having it grab the activity_id. My thought was to create a BP version of post-social-share and items-like.php.
If you think that would work, my only challenge is how to get the bp_activity_id() into the process.
This seems like the key part
function do_likes_bp( $post_id = null )
{
if ( ! $post_id ) {
global $post;
$post_id = $post->ID;
}if ( defined('ICL_SITEPRESS_VERSION') ){
global $sitepress;
$post_id = icl_object_id( $post_id, 'post', true, $sitepress->get_default_language() );
}$output = $this->like_this_bp($post_id, sq_option('likes_zero_text', ''), sq_option('likes_one_text', ''), sq_option('likes_more_text', ''));
$class = 'item-likes';
$title = sq_option('like_this_text', 'Like this');
if( isset($_COOKIE['item_likes_'. $post_id]) ){
$class = 'item-likes liked';
$title = sq_option('likes_already', 'You already like this');
}return ''. $output .'';
}Any thoughts?
September 30, 2015 at 03:20 #80006AndreiModerator@efullman, yes the code could be adapted but it’s better to use radu’s suggestion.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 7, 2015 at 17:07 #81321efullmanParticipantI got that code to work. However, the posted plugin actually has include files missing so it won’t actually run. I had to download the develop branch off the Github for this plugin and then debug a few things.
However, now it works. I wouldn’t direct anyone to WordPress Plugins to download this directly.
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.