Italian (Italy)
Knowledge Base  >  Vik Appointments  >  Hook  >  Dipendente  >  Area Privata  >  Registrazione  >  Toggle Subscription Fields

apply_filters( 'vikappointments_toggle_employee_subscription_fields', bool $status, array &$allowed, array $billing, object $employee )

Fires before displaying the billing form to purchase an employee subscription.


Description

Trigger hook to toggle the visibility of certain fields from the Subscriptions page under the Employees Area.

In example, by using the code below, the user profile won't display the VAT Number field anymore.

$allowed['vat'] = false;
// or
unset($allowed['vat']);

Parameters

$status

(bool)  True on success, false otherwise.

&$allowed

(array)  An associative array containing all the allowed fields, where the key is the field identifier and the value represents its visibility.

  • country - the dropdown to pick the country;
  • state - the text field to enter the state/province;
  • city - the text field to enter the city name;
  • address - the text field to enter the address field;
  • zip - the text field to enter the ZIP code;
  • company - the text field to enter the company name;
  • vat - the text field to enter the VAT number.

Assigning new attributes to the array will have no effect.

$billing

(array)  An array holding the currently set billing details.

$employee

(object)  The details of the currently logged-in employee.


Example

The following example hides the Company and VAT Number fields only if they are empty.

/**
 *  Trigger hook to toggle the visibility of certain fields.
 *
 * @param  boolean  $status    True on success, false otherwise.
 * @param  array    &$allowed  An array of allowed fields.
 * @param  array    $billing   An associative array containing the
 *                             value of the billing fields.
 * @param  object   $employee  The employee details.
 */
add_filter('vikappointments_toggle_employee_subscription_fields', function($status, &$allowed, $billing, $employee)
{
    // check whether the Company field is empty
    if (empty($billing['company']))
    {
        // hide field
        $allowed['company'] = false;
    }

    // check whether the VAT Number field is empty
    if (empty($billing['vat']))
    {
        // hide field
        $allowed['vat'] = false;
    }

    return $status;
}, 10, 4);

Changelog

Version Description
1.2 Introduced.
Ultimo aggiornamento: 2021-10-08
Utile?

Questo sito web utilizza i cookie

Questo sito web utilizza cookie e tecnologie simili. Alcune di queste tecnologie sono necessarie per il corretto funzionamento del sito web (essenziali). Altre tecnologie sono utilizzate per valutare il comportamento degli utenti (analisi), per integrare media esterni o per scopi pubblicitari. Se l'utente accetta, queste tecnologie vengono attivate. I dettagli sono riportati nella Privacy Policy. Da questa stessa pagina è inoltre possibile aggiornare/revocare il consenso. Se non si fornisce il consenso, verranno attivati solo i cookie con funzioni essenziali.

Sul nostro sito web utilizziamo tecnologie provenienti dagli Stati Uniti. Pertanto, se acconsentite, acconsentite anche al trasferimento dei vostri dati negli Stati Uniti. Desideriamo sottolineare che gli Stati Uniti non hanno un livello di protezione dei dati paragonabile a quello dell'Unione Europea e che qualsiasi azienda statunitense può essere obbligata dalle autorità statali a consegnare i vostri dati senza che voi abbiate alcuno strumento efficace di protezione legale contro questo.