This topic has 4 replies, 3 voices, and was last updated 5 years by Radu.

  • Author
  • #217198
     forrest
    Participant

    Regarding the KLEO included Membership plugin, is there a function to assign a Membership Level automatically to all new WP Users created?

    We are using Google login plugin to automatically create a WP User when we set them up by email. This works great in creating their WP User, but still requires us to manually give them a membership level.

    We are looking to automate that process by having a membership level automatically assigned to all new users created.

    #217231
     Laura
    Moderator

    Hello, will assign the ticket to a higher support level who can help and advise you in your query.
    Thanks! ?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #217255
     Radu
    Moderator

    Hi,

    Using this snippet you can assign a certain membership at signup.

    COPY CODE
    
    /**
    	* When registering, add the member to a specific membership level 
    	* @param integer $user_id
    **/
    
    //Disables the pmpro redirect to levels page when user tries to register
    add_filter("pmpro_login_redirect", "__return_false");
    
    function my_pmpro_default_registration_level($user_id) {
    	//Give all members who register membership level 1
    	pmpro_changeMembershipLevel(1, $user_id);
    }
    add_action('user_register', 'my_pmpro_default_registration_level');
    

    It can be added into child theme functions.php, make sure to have child theme activated.

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #217257
     forrest
    Participant

    Thanks for the reply….

    Quick follow up –

    we are on boarding people into the community via the normal WordPress “User” tab interface currently (because we are using Google Apps Login to assign emails and auto User level)

    We aren’t using the PMP as a signup, but rather a way to limit/protect community pages…

    ? will your code snippet still work in this use case if we do not use PMP for signup?

    #217305
     Radu
    Moderator

    Hi,

    YEs,

    So you are using the wp roles ?

    If yes you can use the next snippet to change the user default assigned ‘Subscriber’ role at signup to your desired one.

    COPY CODE
    
    add_filter('pre_option_default_role', function($default_role){
        // You can also add conditional tags here and return whatever
        return 'subscriber'; // This is changed
        return $default_role; // This allows default
    });
    
    

    taken from here; https://wordpress.stackexchange.com/questions/31791/how-do-i-programmatically-set-default-role-for-new-users

    Let me know

    Cheers
    R

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘Plugins questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?