Last active
March 14, 2022 09:02
-
-
Save Alimir/6d5b4322de8bab818cf162bd6a20c8e7 to your computer and use it in GitHub Desktop.
Display like buttons in buddyboss activites + comments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Use this hook to disable default buddyboss like button: | |
add_filter( 'bp_is_activity_like_active', '__return_false' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.acomment-wpulike{ | |
border-left: 0; | |
margin: 15px 0 15px 51px; | |
padding: 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* BuddyBoss activity content display | |
* | |
* @return void | |
*/ | |
function wp_ulike_custom_buddypress_activity_content() { | |
echo wp_ulike_buddypress('put', array( 'id' => bp_get_activity_id() )); | |
} | |
add_action( 'bp_after_activity_activity_content', 'wp_ulike_custom_buddypress_activity_content', 10 ); | |
/** | |
* Buddyboss activity comments display | |
* | |
* @param array $return The list of buttons ordered. | |
* @param int $activity_comment_id The current activity comment ID. | |
* @param int $activity_id The current activity ID. | |
* @return void | |
*/ | |
function wp_ulike_custom_buddypress_activity_comment_content( &$return, $activity_comment_id, $activity_id ) { | |
echo sprintf('<div class="acomment-wpulike">%s</div>', wp_ulike_buddypress('put', array( 'id' => $activity_comment_id ))); | |
} | |
add_action( 'bp_nouveau_return_activity_comment_buttons', 'wp_ulike_custom_buddypress_activity_comment_content', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment