| @@ 44-56 (lines=13) @@ | ||
| 41 | * |
|
| 42 | * @param int $user_id ID of the user against which save() is ran |
|
| 43 | **/ |
|
| 44 | public function save( $user_id ) { |
|
| 45 | // Unhook action to garantee single save |
|
| 46 | remove_action( 'profile_update', array( $this, '_save' ) ); |
|
| 47 | ||
| 48 | $this->set_user_id( $user_id ); |
|
| 49 | ||
| 50 | foreach ( $this->fields as $field ) { |
|
| 51 | $field->set_value_from_input(); |
|
| 52 | $field->save(); |
|
| 53 | } |
|
| 54 | ||
| 55 | do_action( 'carbon_after_save_user_meta', $user_id ); |
|
| 56 | } |
|
| 57 | ||
| 58 | /** |
|
| 59 | * Checks whether the current request is valid |
|
| @@ 135-148 (lines=14) @@ | ||
| 132 | * |
|
| 133 | * @param int $post_id ID of the post against which save() is ran |
|
| 134 | **/ |
|
| 135 | public function save( $post_id ) { |
|
| 136 | // Unhook action to garantee single save |
|
| 137 | remove_action( 'save_post', array( $this, '_save' ) ); |
|
| 138 | ||
| 139 | $this->set_post_id( $post_id ); |
|
| 140 | ||
| 141 | foreach ( $this->fields as $field ) { |
|
| 142 | $field->set_value_from_input(); |
|
| 143 | $field->save(); |
|
| 144 | } |
|
| 145 | ||
| 146 | do_action( 'carbon_after_save_custom_fields', $post_id ); |
|
| 147 | do_action( 'carbon_after_save_post_meta', $post_id ); |
|
| 148 | } |
|
| 149 | ||
| 150 | /** |
|
| 151 | * Perform checks whether the current save() request is valid |
|