Changeset 9373
- Timestamp:
- 01/19/2015 08:11:55 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/bp-activity-classes.php
r9372 r9373 193 193 */ 194 194 public function save() { 195 global $wpdb, $bp; 195 global $wpdb; 196 197 $bp = buddypress(); 196 198 197 199 $this->id = apply_filters_ref_array( 'bp_activity_id_before_save', array( $this->id, &$this ) ); … … 221 223 do_action_ref_array( 'bp_activity_before_save', array( &$this ) ); 222 224 223 if ( !$this->component || !$this->type )225 if ( empty( $this->component ) || empty( $this->type ) ) { 224 226 return false; 225 226 if ( !$this->primary_link ) 227 } 228 229 if ( empty( $this->primary_link ) ) { 227 230 $this->primary_link = bp_loggedin_user_domain(); 231 } 228 232 229 233 // If we have an existing ID, update the activity item, otherwise insert it. 230 if ( $this->id )234 if ( ! empty( $this->id ) ) { 231 235 $q = $wpdb->prepare( "UPDATE {$bp->activity->table_name} SET user_id = %d, component = %s, type = %s, action = %s, content = %s, primary_link = %s, date_recorded = %s, item_id = %d, secondary_item_id = %d, hide_sitewide = %d, is_spam = %d WHERE id = %d", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam, $this->id ); 232 else236 } else { 233 237 $q = $wpdb->prepare( "INSERT INTO {$bp->activity->table_name} ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide, is_spam ) VALUES ( %d, %s, %s, %s, %s, %s, %s, %d, %d, %d, %d )", $this->user_id, $this->component, $this->type, $this->action, $this->content, $this->primary_link, $this->date_recorded, $this->item_id, $this->secondary_item_id, $this->hide_sitewide, $this->is_spam ); 234 235 if ( false === $wpdb->query( $q ) ) 238 } 239 240 if ( false === $wpdb->query( $q ) ) { 236 241 return false; 242 } 237 243 238 244 // If this is a new activity item, set the $id property 239 if ( empty( $this->id ) ) 245 if ( empty( $this->id ) ) { 240 246 $this->id = $wpdb->insert_id; 241 247 242 248 // If an existing activity item, prevent any changes to the content generating new @mention notifications. 243 else249 } else { 244 250 add_filter( 'bp_activity_at_name_do_notifications', '__return_false' ); 251 } 245 252 246 253 /**
Note: See TracChangeset
for help on using the changeset viewer.