BuddyDev

Search

[Resolved] remove activity delete button text

  • Participant
    Level: Enlightened
    Posts: 26
    Ahmed on #10141

    hi,
    To remove the text from the activity delete button and replace it by an icon, I inspected bp-activity-template.php file, and in line 2616 there is the function bp_activity_delete_link() called in entry.php file, and the hook bp_get_activity_delete_link.

    function bp_get_activity_delete_link() {
    
    		$url   = bp_get_activity_delete_url();
    		$class = 'delete-activity';
    
    		// Determine if we're on a single activity page, and customize accordingly.
    		if ( bp_is_activity_component() && is_numeric( bp_current_action() ) ) {
    			$class = 'delete-activity-single';
    		}
    
    		$link = '<a href="' . esc_url( $url ) . '" rel="nofollow">' . __( 'Delete', 'buddypress' ) . '</a>';
    
    		/**
    		 * Filters the activity delete link.
    		 *
    		 * @since 1.1.0
    		 *
    		 * @param string $link Activity delete HTML link.
    		 */
    		return apply_filters( 'bp_get_activity_delete_link', $link );
    	}

    To remove the text of the button, I created this function whith the sample of the original hook

    function yoostart_remove_activity_delete_text(){
        $url   = bp_get_activity_delete_url();
        $class = 'delete-activity';
    
        $link = '<a href="' . esc_url( $url ) . '" rel="nofollow">' . __( '', 'buddypress' ) . '</a>';
        return $link;
    }
    add_filter('bp_get_activity_delete_link', 'yoostart_remove_activity_delete_text' );

    it’s work, but i’m beginner and I would like to know if this function isn’t likely to create errors

    thank you
    Ahmed

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2541
    Ravi on #10143

    Hello Ahmed,

    Thank for posting. There will be no errors due to your function. It will hide delete button all over the places like member’s activity, group’s activity etc.

    Thank You
    Ravi

  • Participant
    Level: Enlightened
    Posts: 26
    Ahmed on #10144

    hello Ravi,
    Thank you

    Ahmed

  • Keymaster
    (BuddyDev Team)
    Posts: 22513
    Brajesh Singh on #10150

    Thank you for the help here @ravisharma

    Closing it since it is resolved.

The topic ‘ [Resolved] remove activity delete button text’ is closed to new replies.

This topic is: resolved