Changeset 6003 for trunk/bp-core/deprecated/1.6.php
- Timestamp:
- 04/21/2012 05:26:22 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/deprecated/1.6.php
r5808 r6003 54 54 */ 55 55 56 /* 56 /** 57 57 * @deprecated 1.6 58 58 * @deprecated No longer used; see bp_blogs_transition_activity_status() … … 66 66 */ 67 67 68 /* 68 /** 69 69 * @deprecated 1.6 70 70 * @deprecated No longer used; see BP_Admin::admin_menus() … … 74 74 } 75 75 76 /** 77 * @deprecated 1.6 78 * @deprecated No longer used. We do ajax properly now. 79 */ 80 function bp_core_add_ajax_hook() { 81 _deprecated_function( __FUNCTION__, '1.6', 'No longer used' ); 82 } 76 83 77 84 /** … … 125 132 return apply_filters( 'bp_core_email_from_address_filter', 'noreply@' . $domain[2] ); 126 133 } 134 135 /** 136 * Backward compatibility for AJAX callbacks that do not die() on their own 137 * 138 * In BuddyPress 1.6, BP was altered so that it uses admin-ajax.php (instead of wp-load.php) for 139 * AJAX requests. admin-ajax.php dies with an output of '0' (to signify an error), so that if an 140 * AJAX callback does not kill PHP execution, a '0' character will be erroneously appended to the 141 * output. All bp-default AJAX callbacks (/bp-themes/bp-default/_inc/ajax.php) have been updated 142 * for BP 1.6 so that they die() properly; any theme that dynamically includes this file will 143 * inherit the fixes. However, any theme that contains a copy of BP's pre-1.5 ajax.php file will 144 * continue to witness the 'trailing "0"' problem. 145 * 146 * This function provides a backward compatible workaround for these themes, by hooking to the 147 * BP wp_ajax_ actions that were problematic prior to BP 1.6, and killing PHP execution with die(). 148 * 149 * Note that this hack only runs if the function bp_dtheme_register_actions() is not found (this 150 * function was introduced in BP 1.6 for related backward compatibility reasons). 151 */ 152 if ( !function_exists( 'bp_dtheme_register_actions' ) ) : 153 function bp_die_legacy_ajax_callbacks() { 154 155 // This is a list of the BP wp_ajax_ hook suffixes whose associated functions did 156 // not die properly before BP 1.6 157 $actions = array( 158 // Directory template loaders 159 'members_filter', 160 'groups_filter', 161 'blogs_filter', 162 'forums_filter', 163 'messages_filter', 164 165 // Activity 166 'activity_widget_filter', 167 'activity_get_older_updates', 168 'post_update', 169 'new_activity_comment', 170 'delete_activity', 171 'delete_activity_comment', 172 'spam_activity', 173 'spam_activity_comment', 174 'activity_mark_fav', 175 'activity_mark_unfav', 176 177 // Groups 178 'groups_invite_user', 179 'joinleave_group', 180 181 // Members 182 'addremove_friend', 183 'accept_friendship', 184 'reject_friendship', 185 186 // Messages 187 'messages_close_notice', 188 'messages_send_reply', 189 'messages_markunread', 190 'messages_markread', 191 'messages_delete', 192 'messages_autocomplete_results' 193 ); 194 195 // For each of the problematic hooks, exit at the very end of execution 196 foreach( $actions as $action ) { 197 add_action( 'wp_ajax_' . $action, create_function( '', 'exit;' ), 9999 ); 198 add_action( 'wp_ajax_nopriv_' . $action, create_function( '', 'exit;' ), 9999 ); 199 } 200 } 201 add_action( 'after_setup_theme', 'bp_die_legacy_ajax_callbacks', 20 ); 202 endif; 127 203 ?>
Note: See TracChangeset
for help on using the changeset viewer.