Skip Navigation

[Gelöst] Expiration date – required field

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:

The issue here is that the user wanted to make a CRED generic field required.

Solution:

To do this just add this attribute to the CRED generic code "required":1,

This support ticket is created vor 6 Jahren, 7 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Dieses Thema enthält 4 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von leilaG vor 6 Jahren, 7 Monaten.

Assistiert von: Shane.

Author
Artikel
#810818

We are using the below function, how do we make this a required field?

add_action('cred_save_data', 'set_expiry_date', 10, 2);
function set_expiry_date($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==17313)
{
if (isset($_POST['expiration-date']['datepicker']))
{
// add it to saved post meta
update_post_meta($post_id, '_cred_post_expiration_time', $_POST['expiration-date']['datepicker']);
}
}
}

#812892

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Leila,

Thank you for contacting our support forum.

Was this field created using our Types plugin or was it done using the CRED generic fields ?

Please let me know.
Thanks,
Shane

#854735

It was created by CRED generic field.

#857358

Shane
Supporter

Sprachen: Englisch (English )

Zeitzone: America/Jamaica (GMT-05:00)

Hi Leila,

What you can do is to just add the paramater "required":1,

Thanks,
Shane

#857544

Perfect! Thanks 🙂