This topic has 6 replies, 2 voices, and was last updated 9 years by infinitelinx.

  • Author
  • #19436
     infinitelinx
    Participant

    After someone registers, how can their membership level automatically be set to a specific one? I have a FREE membership level that expires after 14 days. How do I set new registered users to that level the moment they register?

    Thank you.

    #19465
     Anchora
    Participant

    as provided earlier:

    COPY CODE
    
    add_action('user_register', 'kleo_pmpro_default_level');
    function kleo_pmpro_default_level($user_id) {
    	pmpro_changeMembershipLevel(9,$user_id);
    }
    

    where “9” is the default-level, in this case.

    but remember that this snippet will kill the registrationprocess, if pmpro is DEactivated.

    #19547
     infinitelinx
    Participant

    Hi there,

    Where do I enter that code? Also, PMPRO is activated.

    Julie

    #19549
     Anchora
    Participant

    wp-content/themes/sweetdate-child
    functions.php

    #19555
     infinitelinx
    Participant

    I entered the following in sweet-child/functions.php and changed 9 to 1 because that is the ID for the FREE membership level setup in PMPRO. When I do this and try to log out of WP so I can register and test it out, I get the attached error. Also, you stated “as provided earlier:” however, I don’t see anything about that in the SweetDate documentation. Thank you.

    <?php
    /**
    * @package WordPress
    * @subpackage Sweetdate
    * @author SeventhQueen <themesupport@seventhqueen.com>
    * @since Sweetdate 1.0
    */

    /**
    * Sweetdate Child Theme Functions
    * Add extra code or replace existing functions
    */

    add_action(‘user_register’, ‘kleo_pmpro_default_level’);
    function kleo_pmpro_default_level($user_id) {
    pmpro_changeMembershipLevel(1,$user_id);
    }

    ?>

    Attachments:
    You must be logged in to view attached files.
    #19557
     Anchora
    Participant

    it’s not in the documentation, but a sticky thread in the forum:
    https://archived.seventhqueen.com/forums/topic/membership-auto-in-registration

    with “headers alredy sent” I would have a look for spaces before the <?php …

    can’t tell you exactly.
    but abe surely will.
    🙂

    #19559
     infinitelinx
    Participant

    Ok, I clicked on that thread and copied his code and it worked. It looks like the exact same code but I think some characters were converted by email so I copied and pasted the wrong one. Thanks. This seems to work now.

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Registration’ is closed to new replies.

Log in with your credentials

Forgot your details?