באַניץ־גייד פֿאַר Hooks
Ultimate Multisite גיט 200+ אַקציע־Hooks און 280+ פילטער־Hooks. די זײַט באַהאַנדלט די מערסט אָפֿט געניצטע Hooks מיט פּראַקטישע בײַשפּילן. פֿאַר אַ פולשטענדיקע אויטאָמאַטיש־גענערירטע רעפֿערענץ, בלעטערט די אַנדערע זײַטן אין דעם אָפּטייל.
אַקציע־Hooks
קונה־לעבנסציקל
נאָך קונה־שאַפונג
/**
* @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!'
);
});
ענדערונג פֿון קונה־סטאַטוס
/**
* @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);
וועבזײַט־Hooks
נאָך דעם וואָס די וועבזײַט איז פּובליקירט געוואָרן
/**
* @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);
פֿאַר מוסטער־אָנווענדונג
/**
* @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);
מיטגלידערשאַפֿט־Hooks
סטאַטוס־איבערגאַנגען
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();
}
});