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