BuddyDev

Search

[Resolved] BuddyPress Edit and GamiPress

  • Participant
    Level: Enlightened
    Posts: 64
    Katrine Spencer on #52709

    Hello

    I just noticed that members have access to edit activity posts of achievements made within GamiPress.

    If one of my members get an achievement (a badge) they’re able to edit that like if they made the activity post themselves which is not optimal.

    Can this be fixed please?

    Thanks! 🙂

    https://ibb.co/pL8Ykhj
    https://ibb.co/SKG5pRh

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 3115
    Ravi on #52713

    Hello Katrine,

    Thank you for posting. The activities generated by “Gamipress” are normal activities just like user-posted activities but in this case, The Gamipress plugin is posting these for the user on some kind of achievements that’s why they are able to edit those activities as well. But with small code, you can restrict users from editing such activities. Please use the following code in the file “bp-custom.php”

    
    add_filter( 'bp_editable_activity_can_edit_activity', function ( $can, $activity ) {
    
    	if ( isset( $activity->component ) && 'gamipress' == $activity->component ) {
    		$can = false;
    	}
    
    	return $can;
    }, 10, 2 );
    
    

    More info on “bp-custom.php”. Check here: https://buddydev.com/docs/buddypress-guides/what-is-bp-custom-php/

    Regards
    Ravi

  • Participant
    Level: Enlightened
    Posts: 64
    Katrine Spencer on #52724

    That worked – thank you! 🙂

The topic ‘ [Resolved] BuddyPress Edit and GamiPress’ is closed to new replies.

This topic is: resolved