Hooks ਵਰਤੋਂ ਗਾਈਡ
Ultimate Multisite 200+ action hooks ਅਤੇ 280+ filter hooks ਪ੍ਰਦਾਨ ਕਰਦਾ ਹੈ। ਇਹ ਪੇਜ ਸਭ ਤੋਂ ਵੱਧ ਵਰਤੇ ਜਾਣ ਵਾਲੇ hooks ਨੂੰ ਵਿਹਾਰਕ ਉਦਾਹਰਣਾਂ ਨਾਲ ਕਵਰ ਕਰਦਾ ਹੈ। ਪੂਰੇ ਆਟੋ-ਜਨਰੇਟਡ reference ਲਈ, ਇਸ ਸੈਕਸ਼ਨ ਦੇ ਹੋਰ ਪੇਜਾਂ ਨੂੰ ਵੇਖੋ।
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) {
// React to status transitions
}, 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);
Before Template Application (template ਲਾਗੂ ਕਰਨ ਤੋਂ ਪਹਿਲਾਂ)
/**
* @param int $site_id
* @param int $template_id
*/
add_action('wu_before_apply_template', function($site_id, $template_id) {
switch_to_blog($site_id);
if ($template_id === 5) {
update_option('woocommerce_store_setup', 'complete');
}
restore_current_blog();
}, 10, 2);
Membership Hooks (ਮੈਂਬਰਸ਼ਿਪ hooks)
Status Transitions (ਸਥਿਤੀ ਤਬਦੀਲੀਆਂ)
add_action('wu_membership_status_to_active', function($membership) {
// Membership activated
});
add_action('wu_membership_status_to_expired', function($membership) {
$sites = $membership->get_sites();
foreach ($sites as $site) {
$site->set_status('suspended');
$site->save();
}
});
Payment Hooks (भुगतान hooks)
Payment Completed / Failed (भुगतान ਪੂਰਾ ਹੋਣ/ਫੇਲ ਹੋਣ 'ਤੇ)
add_action('wu_payment_completed', function($payment) {
// Handle successful payment
});
add_action('wu_payment_failed', function($payment, $error_message) {
$admin_email = get_option('admin_email');
wp_mail(
$admin_email,
'Payment Failed',
sprintf('Payment #%d failed: %s', $payment->get_id(), $error_message)
);
}, 10, 2);
Checkout Hooks (चेकआउट hooks)
Before Processing / After Completion (ਪ੍ਰੋਸੈਸਿੰਗ ਤੋਂ ਪਹਿਲਾਂ / ਪੂਰਾ ਹੋਣ ਤੋਂ ਬਾਅਦ)
/**
* @param WP_Ultimo\Checkout\Cart $cart
*/
add_action('wu_checkout_before_processing', function($cart) {
// Validate or modify cart before processing
});
/**
* @param WP_Ultimo\Models\Payment $payment
* @param WP_Ultimo\Models\Customer $customer
* @param WP_Ultimo\Models\Membership $membership
*/
add_action('wu_checkout_completed', function($payment, $customer, $membership) {
// Track conversion, send notifications, etc.
}, 10, 3);
Domain Hooks (ਡੋਮੇਨ hooks)
add_action('wu_domain_mapped', function($domain) {
// Update CDN or DNS configuration
});
add_action('wu_domain_ssl_verified', function($domain) {
// SSL certificate verified for domain
});