Few questions about membership plugin

Hi Barry , the membership plugin is really evolving , great work.

I have a couple of questions.

My site is set up as follows

None registered users cannot access the blog section and registered users can , simple !!

When a user registers I want to be able to approve them. So basically I do not really need subcriptions just levels.

At the moment if I try and register I can fill in the form in the first section , but when I press submit , I would like it to say your registration is pending approval at the moment it takes me to step 2 which I do not need as I do not have any subscription and there cannot do anything with this.

Also in the normal buddy press registration it lets you change your gravity/avatar is their a way of adding this into the sign up process.

and finally when i approve a member in the backend and give him access to level 1 for example is there any code I could add to fire off an email saying that your membership has been approved?

  • Barry

    Hi
    I'll do a rough answer initially with some areas to look at. I'm looking for some scenarios that I can write up as tutorials to show how flexible the system is, so some of the ideas here will be userful.

    Okay - step 1 - create a php file to place in the membershipincludes/plugins directory

    At the moment if I try and register I can fill in the form in the first section , but when I press submit , I would like it to say your registration is pending approval at the moment it takes me to step 2 which I do not need as I do not have any subscription and there cannot do anything with this.

    1. When they complete step 1, the user account is created but is not activated, so they can't login until it is - this will already give you the "can't access until approved" scenario.

    2. Add a filter for "membership_subscription_form_after_content", the filter will pass in two parameters, the html of the susbscription selection page and the user_id of the created user. You need to return the html of your confirmation page back. So an example function would be:


    funciton override_page_two($content, $user_id = false) {
    $content = "Hellow this is my new page two";

    return $content;
    }

    By doing this you have effectively overriden the default subscription page. You could get quite complex with this and create an entirely new path from here. Including, as you mention further down in your question - re-implementing the avatar upload page.

    step 2 - email notification

    and finally when i approve a member in the backend and give him access to level 1 for example is there any code I could add to fire off an email saying that your membership has been approved?

    You will need to hook into another action for this (a good example to look at is the file called newsstream.php in the membershipincludes/plugins directory). Add an action for "membership_add_level", it will pass two parameters the level_id that is being added and the user_id. You will need to perform a couple of actions in the function, 1. Activate the user, 2. Send the email. So an example would be:


    function inform_member($level_id, $user_id) {

    $member = new M_Membership( $user_id );
    if(!$member->active_member()) {
    // This makes the member account active so they can log in
    $member->toggle_activation();
    }

    // Send the email here
    $result = @wp_mail( $member->user_email, 'Subject', 'Message');

    }

    The second part will fire off an email everytime a level is assigned, if you don't want to do that - then move the emailing inside the if statement that checks if the user account isn't active - then the email will only be sent if the user has a level added from a deactivated account (i.e. just signed up).

    Hope the above makes some sense to you :slight_smile: If not, or even if it does, shout with questions and I'll try to answer as best I can.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.