Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function activity_is_promoted() {
- echo get_activity_is_promoted();
- }
- function get_activity_is_promoted() {
- global $bp, $activities_template;
- return apply_filters( 'get_activity_is_promoted', in_array( $activities_template->activity->id, (array)$activities_template->promoted ) );
- }
- function activity_action_mark_promoted() {
- global $bp;
- if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'promoted' )
- return false;
- /* Check the nonce */
- check_admin_referer( 'promoted' );
- if ( activity_add_user_promoted( $bp->action_variables[0] ) )
- bp_core_add_message( __( 'Activity marked as favorite.', 'buddypress' ) );
- else
- bp_core_add_message( __( 'There was an error marking that activity as a promoted, please try again.', 'buddypress' ), 'error' );
- bp_core_redirect( wp_get_referer() . '#activity-' . $bp->action_variables[0] );
- }
- add_action( 'wp', 'activity_action_mark_promoted', 3 );
- function activity_action_remove_promoted() {
- global $bp;
- if ( !is_user_logged_in() || $bp->current_component != $bp->activity->slug || $bp->current_action != 'unpromote' )
- return false;
- /* Check the nonce */
- check_admin_referer( 'unpromote' );
- if ( activity_remove_user_promoted( $bp->action_variables[0] ) )
- bp_core_add_message( __( 'Activity removed as promoted.', 'buddypress' ) );
- else
- bp_core_add_message( __( 'There was an error removing that activity as a promoted, please try again.', 'buddypress' ), 'error' );
- bp_core_redirect( wp_get_referer() . '#activity-' . $bp->action_variables[0] );
- }
- add_action( 'wp', 'activity_action_remove_promoted', 3 );
- function activity_promoted_link() {
- echo get_activity_promoted_link();
- }
- function get_activity_promoted_link() {
- global $activities_template;
- return apply_filters( 'get_activity_promoted_link', wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/promoted/' . $activities_template->activity->id . '/' ), 'mark_promoted' ) );
- }
- function activity_unpromoted_link() {
- echo get_activity_unpromoted_link();
- }
- function get_activity_unpromoted_link() {
- global $activities_template;
- return apply_filters( 'get_activity_unpromoted_link', wp_nonce_url( site_url( BP_ACTIVITY_SLUG . '/unpromoted/' . $activities_template->activity->id . '/' ), 'unmark_promoted' ) );
- }
Advertisement
Add Comment
Please, Sign In to add comment