BuddyDev

Search

DELETE activity using ajax

  • Participant
    Level: Guru
    Posts: 701
    Tosin on #22161

    hi,

    To remove the text from the activity delete button and replace it by an icon I used this code in bp-custom.php

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

    After adding the code the activity update do not delete with ajax again. How can I make the function work with ajax.

    Thanks

  • Keymaster
    Level: Yogi
    (BuddyDev Team)
    Posts: 2459
    Ravi on #22165

    Hello Tosin,

    You are missing CSS classes in the anchor. Please add and then check and let me know if it works or not.

    Thank
    Ravi

  • Participant
    Level: Guru
    Posts: 701
    Tosin on #22169

    I got it to work with this code

     function bpdelete_remove_activity_delete_text(){
        $url   = bp_get_activity_delete_url();
        $class = 'delete-activity';
    
        $link = '<a href="' . esc_url( $url ) . '" class="button item-button bp-secondary-action delete-activity confirm fa fa-trash" rel="nofollow">' . __( '', 'buddypress' ) . '</a>';
        return $link;
    }
    add_filter('bp_get_activity_delete_link', 'bpdelete_remove_activity_delete_text' ); 

    Thanks for the hint,have a great day

You must be logged in to reply to this topic.

This topic is: not resolved