Changeset 1621 for trunk/bp-activity.php
- Timestamp:
- 07/21/2009 09:45:28 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-activity.php
r1599 r1621 189 189 extract( $r, EXTR_SKIP ); 190 190 191 /* Insert the "time-since" placeholder */ 192 if ( $content ) { 193 if ( !$pos = strpos( $content, '<blockquote' ) ) { 194 if ( !$pos = strpos( $content, '<div' ) ) { 195 if ( !$pos = strpos( $content, '<ul' ) ) { 196 $content .= ' <span class="time-since">%s</span>'; 197 } 198 } 199 } 200 201 if ( $pos ) { 202 $before = substr( $content, 0, $pos ); 203 $after = substr( $content, $pos, strlen( $content ) ); 204 205 $content = $before . ' <span class="time-since">%s</span>' . $after; 206 } 207 } 208 191 209 $activity = new BP_Activity_Activity; 192 210 $activity->user_id = $user_id; … … 208 226 } 209 227 210 function bp_activity_update( $args = '' ) { 211 global $bp, $wpdb; 212 213 extract( $args );214 228 /* There are multiple ways to delete activity items, depending on the information you have at the time. */ 229 230 function bp_activity_delete_by_item_id( $args = '' ) { 231 global $bp; 232 215 233 $defaults = array( 216 'user_id' => $bp->loggedin_user->id, 217 'content' => false, 234 'item_id' => false, 218 235 'component_name' => false, 219 236 'component_action' => false, 220 'item_id' => false, 221 'secondary_item_id' => false, 222 'recorded_time' => time(), 223 'hide_sitewide' => false 237 'user_id' => false, // optional 238 'secondary_item_id' => false // optional 224 239 ); 225 240 226 241 $r = wp_parse_args( $args, $defaults ); 227 242 extract( $r, EXTR_SKIP ); 228 229 $activity = new BP_Activity_Activity( $user_id, $component_name, $component_action, $item_id, $secondary_item_id ); 230 $activity->user_id = $user_id; 231 $activity->content = $content; 232 $activity->primary_link = $primary_link; 233 $activity->component_name = $component_name; 234 $activity->component_action = $component_action; 235 $activity->item_id = $item_id; 236 $activity->secondary_item_id = $secondary_item_id; 237 $activity->date_recorded = $recorded_time; 238 $activity->hide_sitewide = $hide_sitewide; 239 240 if ( !$activity->save() ) 241 return false; 242 243 do_action( 'bp_activity_update', $args ); 244 245 return true; 246 } 247 248 /* There are multiple ways to delete activity items, depending on the information you have at the time. */ 249 250 function bp_activity_delete_by_item_id( $user_id, $component_name, $component_action, $item_id, $secondary_item_id = false ) { 251 if ( !BP_Activity_Activity::delete_by_item_id( $user_id, $component_name, $component_action, $item_id, $secondary_item_id ) ) 252 return false; 253 254 do_action( 'bp_activity_delete_by_item_id', $user_id, $component_name, $component_action, $item_id, $secondary_item_id ); 243 244 if ( !BP_Activity_Activity::delete_by_item_id( $item_id, $component_name, $component_action, $user_id, $secondary_item_id ) ) 245 return false; 246 247 do_action( 'bp_activity_delete_by_item_id', $item_id, $component_name, $component_action, $user_id, $secondary_item_id ); 255 248 256 249 return true; … … 345 338 /* DEPRECATED - use bp_activity_delete_by_item_id() */ 346 339 function bp_activity_delete( $item_id, $component_name, $component_action, $user_id, $secondary_item_id ) { 347 if ( !bp_activity_delete_by_item_id( $user_id, $component_name, $component_action, $item_id, $secondary_item_id) )340 if ( !bp_activity_delete_by_item_id( array( 'item_id' => $item_id, 'component_name' => $component_name, 'component_action' => $component_action, 'user_id' => $user_id, 'secondary_item_id' => $secondary_item_id ) ) ) 348 341 return false; 349 342
Note: See TracChangeset
for help on using the changeset viewer.