| @@ 109-122 (lines=14) @@ | ||
| 106 | * |
|
| 107 | * @param int $post_id ID of the post against which save() is ran |
|
| 108 | **/ |
|
| 109 | public function save( $post_id = null ) { |
|
| 110 | // Unhook action to garantee single save |
|
| 111 | remove_action( 'save_post', array( $this, '_save' ) ); |
|
| 112 | ||
| 113 | $this->set_post_id( $post_id ); |
|
| 114 | ||
| 115 | foreach ( $this->fields as $field ) { |
|
| 116 | $field->set_value_from_input( stripslashes_deep( $_POST ) ); |
|
| 117 | $field->save(); |
|
| 118 | } |
|
| 119 | ||
| 120 | do_action( 'carbon_after_save_custom_fields', $post_id ); |
|
| 121 | do_action( 'carbon_after_save_post_meta', $post_id ); |
|
| 122 | } |
|
| 123 | ||
| 124 | /** |
|
| 125 | * Perform checks whether the container should be attached during the current request |
|
| @@ 69-81 (lines=13) @@ | ||
| 66 | * |
|
| 67 | * @param int $user_id ID of the user against which save() is ran |
|
| 68 | **/ |
|
| 69 | public function save( $user_id = null ) { |
|
| 70 | // Unhook action to garantee single save |
|
| 71 | remove_action( 'profile_update', array( $this, '_save' ) ); |
|
| 72 | ||
| 73 | $this->set_user_id( $user_id ); |
|
| 74 | ||
| 75 | foreach ( $this->fields as $field ) { |
|
| 76 | $field->set_value_from_input( stripslashes_deep( $_POST ) ); |
|
| 77 | $field->save(); |
|
| 78 | } |
|
| 79 | ||
| 80 | do_action( 'carbon_after_save_user_meta', $user_id ); |
|
| 81 | } |
|
| 82 | ||
| 83 | /** |
|
| 84 | * Perform checks whether the container should be attached during the current request |
|