Changeset 14187
- Timestamp:
- 12/30/2025 05:01:23 PM (2 months ago)
- Location:
- trunk
- Files:
-
- 8 edited
-
src/bp-activity/bp-activity-functions.php (modified) (7 diffs)
-
src/bp-blogs/bp-blogs-activity.php (modified) (1 diff)
-
src/bp-core/deprecated/15.0.php (modified) (2 diffs)
-
src/bp-friends/bp-friends-activity.php (modified) (2 diffs)
-
src/bp-groups/bp-groups-activity.php (modified) (1 diff)
-
src/bp-xprofile/bp-xprofile-activity.php (modified) (3 diffs)
-
tests/phpunit/testcases/activity/class.BP_Activity_Activity.php (modified) (1 diff)
-
tests/phpunit/testcases/activity/functions.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-functions.php
r14077 r14187 2471 2471 * @param int $post_id ID of the post being unpublished. 2472 2472 * @param WP_Post|null $post Post object. 2473 * @return bool2474 2473 */ 2475 2474 function bp_activity_post_type_unpublish( $post_id = 0, $post = null ) { … … 2498 2497 ); 2499 2498 2500 $deleted = bp_activity_delete _by_item_id( $delete_activity_args );2499 $deleted = bp_activity_delete( $delete_activity_args ); 2501 2500 2502 2501 /** … … 2507 2506 * @param array $delete_activity_args Array of arguments for activity deletion. 2508 2507 * @param WP_Post $post Post object. 2509 * @param bool $ activityWhether or not the activity was successfully deleted.2508 * @param bool $deleted Whether or not the activity was successfully deleted. 2510 2509 */ 2511 2510 do_action( 'bp_activity_post_type_unpublished', $delete_activity_args, $post, $deleted ); 2512 2513 return $deleted; 2514 } 2515 2516 /** 2517 * Create an activity item for a newly posted post type comment. 2511 } 2512 2513 /** 2514 * Create an activity item for a newly published post type comment. 2518 2515 * 2519 2516 * @since 2.5.0 … … 2746 2743 2747 2744 if ( bp_disable_blogforum_comments() ) { 2748 $deleted = bp_activity_delete_by_item_id( array( 2749 'item_id' => get_current_blog_id(), 2750 'secondary_item_id' => $comment_id, 2751 'component' => $activity_comment_object->component_id, 2752 'type' => $activity_comment_object->action_id, 2753 'user_id' => false, 2754 ) ); 2745 $deleted = bp_activity_delete( 2746 array( 2747 'item_id' => get_current_blog_id(), 2748 'secondary_item_id' => $comment_id, 2749 'component' => $activity_comment_object->component_id, 2750 'type' => $activity_comment_object->action_id, 2751 'user_id' => false, 2752 ) 2753 ); 2755 2754 } 2756 2755 … … 2999 2998 * array of activity IDs depending on the number deleted. 3000 2999 * 3001 * If you are deleting an activity comment please use bp_activity_delete_comment();3000 * If you are deleting an activity comment please use `bp_activity_delete_comment()`; 3002 3001 * 3003 3002 * @since 1.0.0 … … 3084 3083 } 3085 3084 3086 /**3087 * Delete an activity item by activity id.3088 *3089 * You should use bp_activity_delete() instead.3090 *3091 * @since 1.1.03092 * @deprecated 1.2.03093 *3094 * @param array|string $args See BP_Activity_Activity::get for a3095 * description of accepted arguments.3096 * @return bool3097 */3098 function bp_activity_delete_by_item_id( $args = '' ) {3099 3100 $r = bp_parse_args(3101 $args,3102 array(3103 'item_id' => false,3104 'component' => false,3105 'type' => false,3106 'user_id' => false,3107 'secondary_item_id' => false,3108 )3109 );3110 3111 return bp_activity_delete( $r );3112 }3113 3114 /**3115 * Delete an activity item by activity id.3116 *3117 * @since 1.1.03118 *3119 *3120 * @param int $activity_id ID of the activity item to be deleted.3121 * @return bool3122 */3123 function bp_activity_delete_by_activity_id( $activity_id ) {3124 return bp_activity_delete( array( 'id' => $activity_id ) );3125 }3126 3127 /**3128 * Delete an activity item by its content.3129 *3130 * You should use bp_activity_delete() instead.3131 *3132 * @since 1.1.03133 * @deprecated 1.2.03134 *3135 *3136 * @param int $user_id The user id.3137 * @param string $content The activity id.3138 * @param string $component The activity component.3139 * @param string $type The activity type.3140 * @return bool3141 */3142 function bp_activity_delete_by_content( $user_id, $content, $component, $type ) {3143 return bp_activity_delete( array(3144 'user_id' => $user_id,3145 'content' => $content,3146 'component' => $component,3147 'type' => $type3148 ) );3149 }3150 3151 /**3152 * Delete a user's activity for a component.3153 *3154 * You should use bp_activity_delete() instead.3155 *3156 * @since 1.1.03157 * @deprecated 1.2.03158 *3159 *3160 * @param int $user_id The user id.3161 * @param string $component The activity component.3162 * @return bool3163 */3164 function bp_activity_delete_for_user_by_component( $user_id, $component ) {3165 return bp_activity_delete( array(3166 'user_id' => $user_id,3167 'component' => $component3168 ) );3169 }3170 3171 3085 /** 3172 3086 * Delete an activity comment. … … 3239 3153 return $deleted; 3240 3154 } 3241 3242 3155 /** 3243 3156 * Delete an activity comment's children. -
trunk/src/bp-blogs/bp-blogs-activity.php
r14077 r14187 498 498 ); 499 499 500 return bp_activity_delete _by_item_id( $r );500 return bp_activity_delete( $r ); 501 501 } 502 502 -
trunk/src/bp-core/deprecated/15.0.php
r14074 r14187 1 1 <?php 2 2 /** 3 * Deprecated Functions 3 * Deprecated Functions. 4 4 * 5 5 * @package BuddyPress … … 19 19 echo bp_get_signup_allowed(); 20 20 } 21 22 /** 23 * Delete an activity item by activity id. 24 * 25 * @since 1.1.0 26 * @deprecated 15.0.0 27 * 28 * @param array|string $args See BP_Activity_Activity::get for a 29 * description of accepted arguments. 30 * @return bool 31 */ 32 function bp_activity_delete_by_item_id( $args = '' ) { 33 _deprecated_function( __FUNCTION__, '15.0.0', 'bp_activity_delete()' ); 34 35 $r = bp_parse_args( 36 $args, 37 array( 38 'item_id' => false, 39 'component' => false, 40 'type' => false, 41 'user_id' => false, 42 'secondary_item_id' => false, 43 ) 44 ); 45 46 return bp_activity_delete( $r ); 47 } 48 49 /** 50 * Delete an activity item by its content. 51 * 52 * @since 1.1.0 53 * @deprecated 15.0.0 54 * 55 * @param int $user_id The user id. 56 * @param string $content The activity id. 57 * @param string $component The activity component. 58 * @param string $type The activity type. 59 * @return bool 60 */ 61 function bp_activity_delete_by_content( $user_id, $content, $component, $type ) { 62 _deprecated_function( __FUNCTION__, '15.0.0', 'bp_activity_delete()' ); 63 64 return bp_activity_delete( 65 array( 66 'user_id' => $user_id, 67 'content' => $content, 68 'component' => $component, 69 'type' => $type 70 ) 71 ); 72 } 73 74 /** 75 * Delete a user's activity for a component. 76 * 77 * @since 1.1.0 78 * @deprecated 15.0.0 79 * 80 * @param int $user_id The user id. 81 * @param string $component The activity component. 82 * @return bool 83 */ 84 function bp_activity_delete_for_user_by_component( $user_id, $component ) { 85 _deprecated_function( __FUNCTION__, '15.0.0', 'bp_activity_delete()' ); 86 87 return bp_activity_delete( 88 array( 89 'user_id' => $user_id, 90 'component' => $component 91 ) 92 ); 93 } 94 95 /** 96 * Delete an activity item by activity id. 97 * 98 * @since 1.1.0 99 * @deprecated 15.0.0 100 * 101 * @param int $activity_id ID of the activity item to be deleted. 102 * @return bool 103 */ 104 function bp_activity_delete_by_activity_id( $activity_id ) { 105 _deprecated_function( __FUNCTION__, '15.0.0', 'bp_activity_delete()' ); 106 107 return bp_activity_delete( array( 'id' => $activity_id ) ); 108 } -
trunk/src/bp-friends/bp-friends-activity.php
r14163 r14187 69 69 * For Friends activity items, this is usually the user ID of one 70 70 * of the friends. 71 * @type string $type The 'type' of the activity item (eg 72 * 'friendship_accepted'). 71 * @type string $type The 'type' of the activity item (e.g.: 'friendship_accepted'). 73 72 * @type int $user_id ID of the user associated with the activity item. 74 73 * } … … 79 78 } 80 79 81 bp_activity_delete_by_item_id( array( 82 'component' => buddypress()->friends->id, 83 'item_id' => $args['item_id'], 84 'type' => $args['type'], 85 'user_id' => $args['user_id'], 86 ) ); 80 $r = bp_parse_args( 81 $args, 82 array( 83 'component' => buddypress()->friends->id, 84 'item_id' => false, 85 'type' => false, 86 'user_id' => false, 87 ) 88 ); 89 90 bp_activity_delete( $r ); 87 91 } 88 92 -
trunk/src/bp-groups/bp-groups-activity.php
r14186 r14187 861 861 */ 862 862 function bp_groups_delete_group_delete_all_activity( $group_id ) { 863 if ( bp_is_active( 'activity' ) ) { 864 bp_activity_delete_by_item_id( array( 863 864 // Bail if Activity component is not active. 865 if ( ! bp_is_active( 'activity' ) ) { 866 return; 867 } 868 869 bp_activity_delete( 870 array( 865 871 'item_id' => $group_id, 866 872 'component' => buddypress()->groups->id 867 ) );868 }873 ) 874 ); 869 875 } 870 876 add_action( 'groups_delete_group', 'bp_groups_delete_group_delete_all_activity' ); -
trunk/src/bp-xprofile/bp-xprofile-activity.php
r13890 r14187 117 117 * @since 1.0.0 118 118 * 119 * for a specific activity.120 *121 119 * @param array|string $args Containing all variables used after bp_parse_args() call. 122 * @return bool123 120 */ 124 121 function xprofile_delete_activity( $args = '' ) { … … 126 123 // Bail if activity component is not active. 127 124 if ( ! bp_is_active( 'activity' ) ) { 128 return false;125 return; 129 126 } 130 127 … … 139 136 140 137 // Delete the activity item. 141 bp_activity_delete _by_item_id( $r );138 bp_activity_delete( $r ); 142 139 } 143 140 -
trunk/tests/phpunit/testcases/activity/class.BP_Activity_Activity.php
r13724 r14187 976 976 public function test_nonexistent_activity_should_have_id_0_after_population() { 977 977 $a = self::factory()->activity->create(); 978 bp_activity_delete_by_activity_id( $a ); 978 979 bp_activity_delete( array( 'id' => $a ) ); 979 980 980 981 $a_obj = new BP_Activity_Activity( $a ); -
trunk/tests/phpunit/testcases/activity/functions.php
r14070 r14187 1394 1394 $a = self::factory()->activity->create(); 1395 1395 1396 bp_activity_delete _by_activity_id( $a);1396 bp_activity_delete( array( 'id' => $a ) ); 1397 1397 1398 1398 $c = bp_activity_new_comment( array( … … 1568 1568 } 1569 1569 1570 /**1571 * @group bp_activity_delete_by_item_id1572 */1573 1570 public function test_bp_activity_delete_by_item_id() { 1574 1571 $args = array( … … 1582 1579 $a = self::factory()->activity->create( $args ); 1583 1580 1584 $this->assertTrue( bp_activity_delete _by_item_id( $args ) );1581 $this->assertTrue( bp_activity_delete( $args ) ); 1585 1582 1586 1583 $found = bp_activity_get_specific( array(
Note: See TracChangeset
for help on using the changeset viewer.