Changeset 2692 for trunk/bp-themes/bp-default/_inc/ajax.php
- Timestamp:
- 02/12/2010 01:17:56 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-themes/bp-default/_inc/ajax.php
r2666 r2692 11 11 12 12 /*** 13 * Each object loop (activity/members/groups/blogs/forums) contains parameters to 13 * This function looks scarier than it actually is. :) 14 * Each object loop (activity/members/groups/blogs/forums) contains default parameters to 14 15 * show specific information based on the page we are currently looking at. 15 16 * The following function will take into account any cookies set in the JS and allow us 16 17 * to override the parameters sent. That way we can change the results returned without reloading the page. 18 * By using cookies we can also make sure that user settings are retained across page loads. 17 19 */ 18 20 function bp_dtheme_ajax_querystring( $object = false ) { … … 61 63 } 62 64 65 /* This function will simply load the template loop for the current object. On an AJAX request */ 63 66 function bp_dtheme_object_template_loader() { 64 67 $object = esc_attr( $_POST['object'] ); … … 70 73 add_action( 'wp_ajax_forums_filter', 'bp_dtheme_object_template_loader' ); 71 74 75 /* This function will load the activity loop template when activity is requested via AJAX */ 72 76 function bp_dtheme_activity_template_loader() { 73 77 global $bp; … … 104 108 add_action( 'wp_ajax_activity_get_older_updates', 'bp_dtheme_activity_template_loader' ); 105 109 110 /* AJAX update posting */ 106 111 function bp_dtheme_post_update() { 107 112 global $bp; … … 120 125 } 121 126 122 if ( empty( $_POST['object'] ) ) { 123 $activity_id = bp_activity_post_update( array( 124 'content' => $_POST['content'] 125 )); 127 if ( empty( $_POST['object'] ) && function_exists( 'bp_activity_post_update' ) ) { 128 $activity_id = bp_activity_post_update( array( 'content' => $_POST['content'] ) ); 126 129 } elseif ( $_POST['object'] == 'groups' ) { 127 if ( !empty( $_POST['item_id'] ) ) { 128 $activity_id = groups_post_update( array( 129 'content' => $_POST['content'], 130 'group_id' => $_POST['item_id'] 131 )); 132 } 133 } else { 130 if ( !empty( $_POST['item_id'] ) && function_exists( 'groups_post_update' ) ) 131 $activity_id = groups_post_update( array( 'content' => $_POST['content'], 'group_id' => $_POST['item_id'] ) ); 132 } else 134 133 $activity_id = apply_filters( 'bp_activity_custom_update', $_POST['object'], $_POST['item_id'], $_POST['content'] ); 135 }136 134 137 135 if ( !$activity_id ) { … … 148 146 add_action( 'wp_ajax_post_update', 'bp_dtheme_post_update' ); 149 147 148 /* AJAX activity comment posting */ 150 149 function bp_dtheme_new_activity_comment() { 151 150 global $bp; … … 202 201 add_action( 'wp_ajax_new_activity_comment', 'bp_dtheme_new_activity_comment' ); 203 202 203 /* AJAX delete an activity */ 204 204 function bp_dtheme_delete_activity() { 205 205 global $bp; … … 228 228 add_action( 'wp_ajax_delete_activity', 'bp_dtheme_delete_activity' ); 229 229 230 /* AJAX delete an activity comment */ 230 231 function bp_dtheme_delete_activity_comment() { 231 232 global $bp; … … 254 255 add_action( 'wp_ajax_delete_activity_comment', 'bp_dtheme_delete_activity_comment' ); 255 256 257 /* AJAX mark an activity as a favorite */ 256 258 function bp_dtheme_mark_activity_favorite() { 257 259 global $bp; … … 262 264 add_action( 'wp_ajax_activity_mark_fav', 'bp_dtheme_mark_activity_favorite' ); 263 265 266 /* AJAX mark an activity as not a favorite */ 264 267 function bp_dtheme_unmark_activity_favorite() { 265 268 global $bp; … … 270 273 add_action( 'wp_ajax_activity_mark_unfav', 'bp_dtheme_unmark_activity_favorite' ); 271 274 275 /* AJAX invite a friend to a group functionality */ 272 276 function bp_dtheme_ajax_invite_user() { 273 277 global $bp; … … 313 317 add_action( 'wp_ajax_groups_invite_user', 'bp_dtheme_ajax_invite_user' ); 314 318 319 /* AJAX add/remove a user as a friend when clicking the button */ 315 320 function bp_dtheme_ajax_addremove_friend() { 316 321 global $bp; … … 343 348 add_action( 'wp_ajax_addremove_friend', 'bp_dtheme_ajax_addremove_friend' ); 344 349 350 /* AJAX accept a user as a friend when clicking the "accept" button */ 345 351 function bp_dtheme_ajax_accept_friendship() { 346 352 check_admin_referer( 'friends_accept_friendship' ); … … 353 359 add_action( 'wp_ajax_accept_friendship', 'bp_dtheme_ajax_accept_friendship' ); 354 360 361 /* AJAX reject a user as a friend when clicking the "reject" button */ 355 362 function bp_dtheme_ajax_reject_friendship() { 356 363 check_admin_referer( 'friends_reject_friendship' ); … … 363 370 add_action( 'wp_ajax_reject_friendship', 'bp_dtheme_ajax_reject_friendship' ); 364 371 372 /* AJAX join or leave a group when clicking the "join/leave" button */ 365 373 function bp_dtheme_ajax_joinleave_group() { 366 374 global $bp; … … 415 423 add_action( 'wp_ajax_joinleave_group', 'bp_dtheme_ajax_joinleave_group' ); 416 424 425 /* AJAX close and keep closed site wide notices from an admin in the sidebar */ 417 426 function bp_dtheme_ajax_close_notice() { 418 427 global $userdata; … … 430 439 add_action( 'wp_ajax_messages_close_notice', 'bp_dtheme_ajax_close_notice' ); 431 440 441 /* AJAX send a private message reply to a thread */ 432 442 function bp_dtheme_ajax_messages_send_reply() { 433 443 global $bp; … … 465 475 add_action( 'wp_ajax_messages_send_reply', 'bp_dtheme_ajax_messages_send_reply' ); 466 476 477 /* AJAX mark a private message as unread in your inbox */ 467 478 function bp_dtheme_ajax_message_markunread() { 468 479 global $bp; … … 480 491 add_action( 'wp_ajax_messages_markunread', 'bp_dtheme_ajax_message_markunread' ); 481 492 493 /* AJAX mark a private message as read in your inbox */ 482 494 function bp_dtheme_ajax_message_markread() { 483 495 global $bp; … … 495 507 add_action( 'wp_ajax_messages_markread', 'bp_dtheme_ajax_message_markread' ); 496 508 509 /* AJAX delete a private message or array of messages in your inbox */ 497 510 function bp_dtheme_ajax_messages_delete() { 498 511 global $bp; … … 511 524 add_action( 'wp_ajax_messages_delete', 'bp_dtheme_ajax_messages_delete' ); 512 525 526 /* AJAX autocomplete your friends names on the compose screen */ 513 527 function bp_dtheme_ajax_messages_autocomplete_results() { 514 528 global $bp;
Note: See TracChangeset
for help on using the changeset viewer.