[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-activity/actions/ -> unfavorite.php (source)

   1  <?php
   2  /**
   3   * Activity: Unfavorite action
   4   *
   5   * @package BuddyPress
   6   * @subpackage ActivityActions
   7   * @since 3.0.0
   8   */
   9  
  10  /**
  11   * Remove activity from favorites.
  12   *
  13   * @since 1.2.0
  14   *
  15   * @return bool False on failure.
  16   */
  17  function bp_activity_action_remove_favorite() {
  18      if ( ! is_user_logged_in() || ! bp_is_activity_component() || ! bp_is_current_action( 'unfavorite' ) )
  19          return false;
  20  
  21      // Check the nonce.
  22      check_admin_referer( 'unmark_favorite' );
  23  
  24      if ( bp_activity_remove_user_favorite( bp_action_variable( 0 ) ) )
  25          bp_core_add_message( __( 'Activity removed as favorite.', 'buddypress' ) );
  26      else
  27          bp_core_add_message( __( 'There was an error removing that activity as a favorite. Please try again.', 'buddypress' ), 'error' );
  28  
  29      bp_core_redirect( wp_get_referer() . '#activity-' . bp_action_variable( 0 ) );
  30  }
  31  add_action( 'bp_actions', 'bp_activity_action_remove_favorite' );


Generated: Wed Jan 29 01:01:45 2020 Cross-referenced by PHPXref 0.7.1