- Timestamp:
- 06/01/2016 09:00:21 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/classes/class-bp-activity-activity.php
r10853 r10858 135 135 136 136 /** 137 * Error holder. 138 * 139 * @since 2.6.0 140 * 141 * @var WP_Error 142 */ 143 public $errors; 144 145 /** 146 * Error type to return. Either 'bool' or 'wp_error'. 147 * 148 * @since 2.6.0 149 * 150 * @var string 151 */ 152 public $error_type = 'bool'; 153 154 /** 137 155 * Constructor method. 138 156 * … … 142 160 */ 143 161 public function __construct( $id = false ) { 162 // Instantiate errors object. 163 $this->errors = new WP_Error; 164 144 165 if ( !empty( $id ) ) { 145 166 $this->id = (int) $id; … … 236 257 do_action_ref_array( 'bp_activity_before_save', array( &$this ) ); 237 258 259 if ( 'wp_error' === $this->error_type && $this->errors->get_error_code() ) { 260 return $this->errors; 261 } 262 238 263 if ( empty( $this->component ) || empty( $this->type ) ) { 239 return false; 264 if ( 'bool' === $this->error_type ) { 265 return false; 266 } else { 267 if ( empty( $this->component ) ) { 268 $this->errors->add( 'bp_activity_missing_component' ); 269 } else { 270 $this->errors->add( 'bp_activity_missing_type' ); 271 } 272 273 return $this->errors; 274 } 240 275 } 241 276
Note: See TracChangeset
for help on using the changeset viewer.