• Resolved ericstz

    (@ericstz)


    Hello,

    I want to know if this plugin can change the group of the user when the subscription is ok.
    Thanks for your help
    Eric

Viewing 5 replies - 1 through 5 (of 5 total)
  • markhf

    (@markhf)

    Hi @ericstz

    Are you talking about changing the user role.?

    Thread Starter ericstz

    (@ericstz)

    Hi @markhf

    Yes exactly, i want to change the wordpress’s status of user after a subscription

    Thanks for your help
    Éric

    markhf

    (@markhf)

    Hi @ericstz

    We have a filter in the plugin while creating a new subscription. Please see below.

    do_action( 'hf_subscription_updated_users_role', $new_role, $user, $role_old );

    You may use this hook to do your necessary changes.

    Thread Starter ericstz

    (@ericstz)

    Hi @markhf

    Thanks for your answer, but I don’t see where in the plugin I can have this filter. In product part of woocommerce ?

    Thanks,
    Eric

    markhf

    (@markhf)

    Hello Eric ( @ericstz ),

    Please add below code snippet in your active theme functions.php

    add_filter('hf_subscription_updated_users_role', 'assign_role_after_subscription', 10, 3);
    
    function assign_role_after_subscription($new_role, $user, $role_old) {
        
        $role = 'mycustomrole'; // string $role = Role name 
        
        $user->add_role( $role );
    
    }
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Change the group of user after subscription’ is closed to new replies.