update acf field handling to centerize every call
This commit is contained in:
@@ -148,6 +148,7 @@ function card_date_exists_CIPF($user_id = null) {
|
||||
*
|
||||
*/
|
||||
$date_now = date_create('today');
|
||||
// we dont use utility fonction 'get_acf_field_CIPF' because we want to know if it was not init. Do we ?
|
||||
$current_date = get_field($acf_card_expiration['_name'], $acf_id);
|
||||
|
||||
if (empty($current_date)) {
|
||||
@@ -196,7 +197,7 @@ function update_card_expiration_CIPF($user_id = null) {
|
||||
*
|
||||
*/
|
||||
$date_plus_one_year = $current_date_limit->add(date_interval_create_from_date_string('+'.$card_duration));
|
||||
update_field($acf_card_expiration['_name'], $date_plus_one_year->format($acf_date_format), $acf_id);
|
||||
set_acf_field_CIPF($acf_card_expiration, $date_plus_one_year->format($acf_date_format), $acf_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user