[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Activity: Favorite action 4 * 5 * @package BuddyPress 6 * @subpackage ActivityActions 7 * @since 3.0.0 8 */ 9 10 /** 11 * Mark activity as favorite. 12 * 13 * @since 1.2.0 14 * 15 * @return bool False on failure. 16 */ 17 function bp_activity_action_mark_favorite() { 18 if ( !is_user_logged_in() || !bp_is_activity_component() || !bp_is_current_action( 'favorite' ) ) 19 return false; 20 21 // Check the nonce. 22 check_admin_referer( 'mark_favorite' ); 23 24 $activity_item = new BP_Activity_Activity( bp_action_variable( 0 ) ); 25 if ( ! bp_activity_user_can_read( $activity_item, bp_loggedin_user_id() ) ) { 26 return false; 27 } 28 29 if ( bp_activity_add_user_favorite( bp_action_variable( 0 ) ) ) 30 bp_core_add_message( __( 'Activity marked as favorite.', 'buddypress' ) ); 31 else 32 bp_core_add_message( __( 'There was an error marking that activity as a favorite. Please try again.', 'buddypress' ), 'error' ); 33 34 bp_core_redirect( wp_get_referer() . '#activity-' . bp_action_variable( 0 ) ); 35 } 36 add_action( 'bp_actions', 'bp_activity_action_mark_favorite' );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Nov 21 01:00:57 2024 | Cross-referenced by PHPXref 0.7.1 |