BuddyDev

Search

[Resolved] Can you help me with the small snippet

Tagged: 

  • Participant
    Level: Initiated
    Posts: 15
    kumar on #30272

    I don’t want to show delete button when the activity is a blog post. Any help will be apprecited.

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

    Hello Kumar,

    Thank you for posting. Are you looking a way to hide delete activity button for blog posts activities? If yes, please let me know which template pack you are using in BuddyPress so that I can help.

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 15
    kumar on #30334

    I am using buddypress legacy template.

  • Participant
    Level: Initiated
    Posts: 15
    kumar on #30359

    Any Idea ?

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #30364

    Hi Kumar,
    We do not offer community support on Weekends. We only provide support for critical issues for our pro members over the weekend.


    @ravisharma
    will assist you with the code on Monday.

    Thank you for your patience.

    Regards
    Brajesh

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

    Hello Kumar,

    Please check the following code it will hide delete button if activity type is new blog post. Please modify as per your requirement.

    
    /**
     * Check if the user can delete activity or not.
     *
     * @param bool                 $can_delete true|false
     * @param BP_Activity_Activity $activity Activity object.
     *
     * @return bool
     */
    function buddydev_activity_user_can_delete( $can_delete, $activity ) {
    
    	if ( isset( $activity->type ) && 'new_blog_post' == $activity->type ) {
    		$can_delete = false;
    	}
    
    	return $can_delete;
    }
    add_filter( 'bp_activity_user_can_delete', 'buddydev_activity_user_can_delete', 10, 2 );
    
    

    Regards
    Ravi

  • Participant
    Level: Initiated
    Posts: 15
    kumar on #30608

    Thanks Ravi , it is working fine.

You must be logged in to reply to this topic.

This topic is: resolved