| @@ 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 |
|
| @@ 155-167 (lines=13) @@ | ||
| 152 | * |
|
| 153 | * @param int $user_id ID of the user against which save() is ran |
|
| 154 | **/ |
|
| 155 | public function save( $user_id ) { |
|
| 156 | // Unhook action to garantee single save |
|
| 157 | remove_action( 'profile_update', array( $this, '_save' ) ); |
|
| 158 | ||
| 159 | $this->set_user_id( $user_id ); |
|
| 160 | ||
| 161 | foreach ( $this->fields as $field ) { |
|
| 162 | $field->set_value_from_input(); |
|
| 163 | $field->save(); |
|
| 164 | } |
|
| 165 | ||
| 166 | do_action( 'carbon_after_save_user_meta', $user_id ); |
|
| 167 | } |
|
| 168 | ||
| 169 | /** |
|
| 170 | * Output the container markup |
|