| @@ 88-101 (lines=14) @@ | ||
| 85 | * |
|
| 86 | * @param int $post_id ID of the post against which save() is ran |
|
| 87 | **/ |
|
| 88 | public function save( $post_id ) { |
|
| 89 | // Unhook action to garantee single save |
|
| 90 | remove_action( 'save_post', array( $this, '_save' ) ); |
|
| 91 | ||
| 92 | $this->set_post_id( $post_id ); |
|
| 93 | ||
| 94 | foreach ( $this->fields as $field ) { |
|
| 95 | $field->set_value_from_input(); |
|
| 96 | $field->save(); |
|
| 97 | } |
|
| 98 | ||
| 99 | do_action( 'carbon_after_save_custom_fields', $post_id ); |
|
| 100 | do_action( 'carbon_after_save_post_meta', $post_id ); |
|
| 101 | } |
|
| 102 | ||
| 103 | /** |
|
| 104 | * Perform checks whether the current save() request is valid |
|
| @@ 98-110 (lines=13) @@ | ||
| 95 | * |
|
| 96 | * @param int $user_id ID of the user against which save() is ran |
|
| 97 | **/ |
|
| 98 | public function save( $user_id ) { |
|
| 99 | // Unhook action to garantee single save |
|
| 100 | remove_action( 'profile_update', array( $this, '_save' ) ); |
|
| 101 | ||
| 102 | $this->set_user_id( $user_id ); |
|
| 103 | ||
| 104 | foreach ( $this->fields as $field ) { |
|
| 105 | $field->set_value_from_input(); |
|
| 106 | $field->save(); |
|
| 107 | } |
|
| 108 | ||
| 109 | do_action( 'carbon_after_save_user_meta', $user_id ); |
|
| 110 | } |
|
| 111 | ||
| 112 | /** |
|
| 113 | * Perform checks whether the container should be attached during the current request |
|