Italian (Italy)

do_action( 'vikrestaurants_before_query_conditional_texts', mixed &$query )

Fires while retrieving the available conditional texts to use for the notification e-mails.


Description 

The system uses the conditional texts to extend the mailing information according to specific conditions.

It is possible to use this hook to manually alter the query used to fetch them from the database.


Parameters

&$query

(mixed)  Either a string or a query builder object.


Example

The example below automatically excludes all the unpublished conditional texts. Since the conditional texts don't support a column to check whether they are published or not, it is assumed that such a column is manually added by altering the database table.

/**
 * Trigger hook to allow external plugins to manipulate the query used
 * to load the conditional texts through this helper class.
 *
 * @param  mixed  &$query  A query builder object.
 *
 * @since  1.3
 */
add_action('vikrestaurants_before_query_conditional_texts', function(&$query) {
    // It is assumed that the database table has been altered accordingly:
    // ALTER TABLE `#__vikrestaurants_mail_text`
    // ADD COLUMN `published` tinyint(1) DEFAULT 1;

    // take only the published conditional texts
    $query->where('m.published = 1');
});

Changelog

Version Description
1.3 Introduced.
Ultimo aggiornamento: 2023-12-20
Utile?
Potrebbe interessarti: