Thread Starter
Jack
(@jack1132132)
Overriding the ARM_mycred_feature class like this works for me:
function arm_mycred_feature_override() {
if (!class_exists('ARM_mycred_feature_custom') && class_exists('ARM_mycred_feature') && class_exists('myCRED_Hook') ){
class ARM_mycred_feature_custom extends ARM_mycred_feature{
function arm_get_mycred_points_by_user($user_id) {
$mycred_current_balance = 0;
if($user_id > 0 && function_exists('mycred_get_users_balance') ) {
//$mycred_current_balance = mycred_get_users_balance( $user_id );
$mycred_current_balance = mycred_get_users_balance( $user_id , 'my_custom_type');
}
return $mycred_current_balance;
}
function arm_update_mycred_points_by_user($user_id, $mycred_exchange_rate, $plan_id) {
$return_val = false;
if($user_id > 0 && $plan_id > 0) {
$mycred_current_balance = $this->arm_get_mycred_points_by_user( $user_id );
if ($mycred_current_balance > $mycred_exchange_rate){
//$mycred_exchange_rate = -1 * ceil(((float)$mycred_exchange_rate));
$mycred_exchange_rate = -1 * floatval($mycred_exchange_rate);
$key = 'arm_mycred_point_key_' . $plan_id;
$return_val = ($this->core->add_creds(
$key,
$user_id,
$mycred_exchange_rate,
$this->prefs[$key]['log'],
$plan_id
));
//$return_val = true;
$arm_debug_log_data = "UserID=".$user_id.", exchange rate=".$mycred_exchange_rate.", plan id=".$plan_id;
do_action('arm_payment_log_entry', 'mycred', 'Update mycred points for user '.$user_id, 'armember', $arm_debug_log_data, $arm_debug_payment_log_id);
}
}
return $return_val;
}
}
global $arm_mycred_feature;
$arm_mycred_feature = new ARM_mycred_feature_custom(array(), 'my_custom_type');
}
}
add_action( 'mycred_load_hooks', 'arm_mycred_feature_override' , 999);
Not super safe incase there’s an update to the module and these functions in particular.
Hello,
I understood your concern and the myCred feature is available in the ARMember pro plugin so if you are using ARMember pro then, kindly open a support ticket from https://support.arpluginshop.com, and after that, the ARMember pro plugin support staff will assist you further.
Thanks
Hello,
For a week haven’t heard back from you so now this thread is closing.
Thanks