bp_activity_action_mark_favorite()

Mark activity as liked.

Description

Return

(bool) False on failure.

Source

File: bp-activity/actions/favorite.php

16
17
18
19
20
21
22
23
24
25
26
27
28
29
function bp_activity_action_mark_favorite() {
    if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'favorite' ) )
        return false;
 
    // Check the nonce.
    check_admin_referer( 'mark_favorite' );
 
    if ( bp_activity_add_user_favorite( bp_action_variable( 0 ) ) )
        bp_core_add_message( __( 'Activity post saved.', 'buddyboss' ) );
    else
        bp_core_add_message( __( 'There was an error saving that post. Please try again.', 'buddyboss' ), 'error' );
 
    bp_core_redirect( wp_get_referer() . '#activity-' . bp_action_variable( 0 ) );
}

Changelog

Changelog
Version Description
BuddyPress 1.2.0 Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.