| @@ 81-93 (lines=13) @@ | ||
| 78 | * |
|
| 79 | * @param int $user_id ID of the user against which save() is ran |
|
| 80 | **/ |
|
| 81 | public function save( $user_id = null ) { |
|
| 82 | // Unhook action to garantee single save |
|
| 83 | remove_action( 'profile_update', array( $this, '_save' ) ); |
|
| 84 | ||
| 85 | $this->set_user_id( $user_id ); |
|
| 86 | ||
| 87 | foreach ( $this->fields as $field ) { |
|
| 88 | $field->set_value_from_input( stripslashes_deep( $_POST ) ); |
|
| 89 | $field->save(); |
|
| 90 | } |
|
| 91 | ||
| 92 | do_action( 'carbon_after_save_user_meta', $user_id ); |
|
| 93 | } |
|
| 94 | ||
| 95 | /** |
|
| 96 | * Get environment array for page request (in admin) |
|
| @@ 99-112 (lines=14) @@ | ||
| 96 | * |
|
| 97 | * @param int $post_id ID of the post against which save() is ran |
|
| 98 | **/ |
|
| 99 | public function save( $post_id = null ) { |
|
| 100 | // Unhook action to garantee single save |
|
| 101 | remove_action( 'save_post', array( $this, '_save' ) ); |
|
| 102 | ||
| 103 | $this->set_post_id( $post_id ); |
|
| 104 | ||
| 105 | foreach ( $this->fields as $field ) { |
|
| 106 | $field->set_value_from_input( stripslashes_deep( $_POST ) ); |
|
| 107 | $field->save(); |
|
| 108 | } |
|
| 109 | ||
| 110 | do_action( 'carbon_after_save_custom_fields', $post_id ); |
|
| 111 | do_action( 'carbon_after_save_post_meta', $post_id ); |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * Get environment array for page request (in admin) |
|