Award GamiPress on Liking Buddyboss Newsfeed

Share This Post

Award GamiPress on Liking Buddyboss Newsfeed

Do you want to award GamiPress on liking BuddyBoss Newsfeed? If yes then you are at the right platform. BuddyBoss Newsfeed has different activity by users and admin but to award GamiPress on liking BuddyBoss Newsfeed might engage users at your site.

Note: GamiPress Plugin and BuddyBoss theme must be configured in order to use these snippets.

Let’s check how it is working…

Snippet 1: Add trigger to award Gamipress on liking BuddyBoss news feed posts

This snippet can be used to add trigger to award Gamipress on liking BuddyBoss news feed posts.

				
					/**
 * Add trigger to award Gamipress on liking BuddyBoss news feed posts
 */
function ldninjas_add_buddyboss_news_feed_trigger( $triggers ) {

    $triggers['buddy_boss_news_feed_like'] = array(
        'liked_buddyboss_news_feed_post' => __( 'Liked BuddyBoss News Feed Posts', 'ldninjas' ),
    );

    return $triggers;
}
add_filter( 'gamipress_activity_triggers', 'ldninjas_add_buddyboss_news_feed_trigger' );
				
			

Snippet 2: Award points/badges/ranks on liking a news feed

The snippet will help to Award points/badges/ranks on liking a news feed.

				
					/**
 *  Award points/badges/ranks on liking a news feed
 */
function ldninjas_award_gamipress( $activity_id, $user_id ) {
    if( ! $user_id ) {
        return;
    }
  
    gamipress_trigger_event( array(
        'event' => 'liked_buddyboss_news_feed_post',
        'user_id' => $user_id
    ) );
}
add_action( 'bp_activity_add_user_favorite', 'ldninjas_award_gamipress', 10, 2 );
				
			

Conclusion

So, All you need to add this code snippet to your theme functions.php file to add a trigger or to award points/badges/ranks on liking a news feed. Enjoy!

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

How to get admin user ID

Share This Post How to get admin User ID? It’s been really difficult for many to get back the admin user ID but it’s so

Award GamiPress on RCPro Membership Renewal

Share This Post Award GamiPress on RCPro Membership Renewal Do you think users can also be awarded points/badges/ranks while RCPro Membership renewal? Yes, you can

Custom Message with myCRED Transfer

Share This Post Custom Message with myCRED Transfer MyCred assigns different points to the users but it’s been sometime noticed that the users want to

Want To Know About Our Services?

small_c_popup-300x296

Let’s Talk To Us With Your Concerns

    Once you send the details, we will be shortly back to you. Thanks!

    small_c_popup-300x296

    Become a valuable part of Team LDninjas

    small_c_popup-300x296

    Be updated with new release by LDninjas!