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