Hooks નો ઉપયોગ કેવી રીતે કરવો
Ultimate Multisite 200+ action hooks અને 280+ filter hooks પ્રદાન કરે છે. આ પેજમાં સૌથી વધુ ઉપયોગમાં લેવાતા hooks ને વ્યવહારુ ઉદાહરણો સાથે આવરી લેવામાં આવ્યા છે. સંપૂર્ણ સ્વચાલિત સંદર્ભ માટે, આ વિભાગમાં અન્ય પેજીસ જુઓ.
Action Hooks
Customer Lifecycle (ગ્રાહક જીવનચક્ર)
After Customer Creation (ગ્રાહક બનાવ્યા પછી)
/**
* @param WP_Ultimo\Models\Customer $customer
*/
add_action('wu_customer_post_create', function($customer) {
wp_mail(
$customer->get_email(),
'Welcome!',
'Thanks for joining our platform!'
);
});
Customer Status Change (ગ્રાહકની સ્થિતિમાં ફેરફાર)
/**
* @param WP_Ultimo\Models\Customer $customer
* @param string $old_status
* @param string $new_status
*/
add_action('wu_customer_status_change', function($customer, $old_status, $new_status) {
// સ્થિતિમાં થયેલા ફેરફારો પર પ્રતિક્રિયા આપવી
}, 10, 3);
Site Hooks (સાઇટ સંબંધિત hooks)
After Site Published (સાઇટ પ્રકાશિત થયા પછી)
/**
* @param WP_Ultimo\Models\Site $site
* @param WP_Ultimo\Models\Membership $membership
*/
add_action('wu_site_published', function($site, $membership) {
switch_to_blog($site->get_id());
activate_plugin('essential-plugin/essential-plugin.php');
restore_current_blog();
}, 10, 2);