Changeset 11940 for trunk/src/bp-core/deprecated/3.0.php
- Timestamp:
- 04/03/2018 10:47:52 AM (8 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-core/deprecated/3.0.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/deprecated/3.0.php
r11939 r11940 84 84 */ 85 85 function bp_get_group_new_topic_button( $group = false ) { 86 _deprecated_function( __FUNCTION__, '3.0', 'legacy forum support removed' ); 86 87 return false; 87 88 } 89 90 /** 91 * Catch a "Mark as Spammer/Not Spammer" click from the toolbar. 92 * 93 * When a site admin selects "Mark as Spammer/Not Spammer" from the admin menu 94 * this action will fire and mark or unmark the user and their blogs as spam. 95 * Must be a site admin for this function to run. 96 * 97 * Note: no longer used in the current state. See the Settings component. 98 * 99 * @since 1.1.0 100 * @since 1.6.0 No longer used, unhooked. 101 * @since 3.0.0 Formally marked as deprecated. 102 * 103 * @param int $user_id Optional. User ID to mark as spam. Defaults to displayed user. 104 */ 105 function bp_core_action_set_spammer_status( $user_id = 0 ) { 106 _deprecated_function( __FUNCTION__, '3.0' ); 107 108 // Only super admins can currently spam users (but they can't spam 109 // themselves). 110 if ( ! is_super_admin() || bp_is_my_profile() ) { 111 return; 112 } 113 114 // Use displayed user if it's not yourself. 115 if ( empty( $user_id ) ) 116 $user_id = bp_displayed_user_id(); 117 118 if ( bp_is_current_component( 'admin' ) && ( in_array( bp_current_action(), array( 'mark-spammer', 'unmark-spammer' ) ) ) ) { 119 120 // Check the nonce. 121 check_admin_referer( 'mark-unmark-spammer' ); 122 123 // To spam or not to spam. 124 $status = bp_is_current_action( 'mark-spammer' ) ? 'spam' : 'ham'; 125 126 // The heavy lifting. 127 bp_core_process_spammer_status( $user_id, $status ); 128 129 // Add feedback message. @todo - Error reporting. 130 if ( 'spam' == $status ) { 131 bp_core_add_message( __( 'User marked as spammer. Spam users are visible only to site admins.', 'buddypress' ) ); 132 } else { 133 bp_core_add_message( __( 'User removed as spammer.', 'buddypress' ) ); 134 } 135 136 // Deprecated. Use bp_core_process_spammer_status. 137 $is_spam = 'spam' == $status; 138 do_action( 'bp_core_action_set_spammer_status', bp_displayed_user_id(), $is_spam ); 139 140 // Redirect back to where we came from. 141 bp_core_redirect( wp_get_referer() ); 142 } 143 } 144 145 /** 146 * Process user deletion requests. 147 * 148 * Note: no longer used in the current state. See the Settings component. 149 * 150 * @since 1.1.0 151 * @since 1.6.0 No longer used, unhooked. 152 * @since 3.0.0 Formally marked as deprecated. 153 */ 154 function bp_core_action_delete_user() { 155 _deprecated_function( __FUNCTION__, '3.0' ); 156 157 if ( !bp_current_user_can( 'bp_moderate' ) || bp_is_my_profile() || !bp_displayed_user_id() ) 158 return false; 159 160 if ( bp_is_current_component( 'admin' ) && bp_is_current_action( 'delete-user' ) ) { 161 162 // Check the nonce. 163 check_admin_referer( 'delete-user' ); 164 165 $errors = false; 166 do_action( 'bp_core_before_action_delete_user', $errors ); 167 168 if ( bp_core_delete_account( bp_displayed_user_id() ) ) { 169 bp_core_add_message( sprintf( __( '%s has been deleted from the system.', 'buddypress' ), bp_get_displayed_user_fullname() ) ); 170 } else { 171 bp_core_add_message( sprintf( __( 'There was an error deleting %s from the system. Please try again.', 'buddypress' ), bp_get_displayed_user_fullname() ), 'error' ); 172 $errors = true; 173 } 174 175 do_action( 'bp_core_action_delete_user', $errors ); 176 177 if ( $errors ) 178 bp_core_redirect( bp_displayed_user_domain() ); 179 else 180 bp_core_redirect( bp_loggedin_user_domain() ); 181 } 182 }
Note: See TracChangeset
for help on using the changeset viewer.