Affiliate module: fix referral approval lifecycle and settings reads
This commit is contained in:
@@ -64,8 +64,32 @@ class AffiliateSettings {
|
||||
'description' => __('Allow affiliates to earn commission when their own user account places an order.', 'woonoow'),
|
||||
'default' => false,
|
||||
],
|
||||
'woonoow_affiliate_share_customer_data' => [
|
||||
'type' => 'toggle',
|
||||
'label' => __('Share Customer Data with Affiliates', 'woonoow'),
|
||||
'description' => __('Allow affiliates to see the name and email of the customers they refer.', 'woonoow'),
|
||||
'default' => false,
|
||||
],
|
||||
];
|
||||
|
||||
return $schemas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read Affiliate module setting from module settings storage with legacy fallback.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get_setting($key, $default = null)
|
||||
{
|
||||
$module_settings = get_option('woonoow_module_affiliate_settings', []);
|
||||
if (is_array($module_settings) && array_key_exists($key, $module_settings)) {
|
||||
return $module_settings[$key];
|
||||
}
|
||||
|
||||
// Legacy fallback for older installs that may store direct option keys.
|
||||
return get_option($key, $default);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user