Home Support Extensions Memberships Membership type

Membership type

  • Author
    Posts
  • wdam

    Hi Ihor,

    Can’t compliment you enough on your work. Can I ask about your membership plugin? If someone registers they don’t seem to be assigned to a membership group until they pick a plan, which makes sense. Is it possible to have new registrants assigned to a membership group automatically?

    Many thanks

    ihor developer

    Thanks!

    It’s possible, but requires code customizations. Please try using restrictions set in HivePress/Settings/Memberships section as the default plan, they are applied to any registered users.

    wdam

    Ok, thanks. I did have one more question. Is it possible to approve new members that choose a plan? I see that you can moderate listings but I couldn’t see a way to approve people that want to upgrade their membership, if there is one. Thanks.

    ihor developer

    There’s no such feature at the moment, but thanks I’ll consider adding it. It’s possible with simple customizations (e.g. changing membership status to “pending” once it’s created) or there may be a workaround if you sell memberships – you can manually mark orders as completed.

    wdam

    Ok, thanks for the advice, I’ll just use a form and add the memberships manually. I’ve asked you quite a few questions so I’ve sent you a little tip through Paypal to say thanks.

    With regard to your message above about code customization for assigning new registrants to a particular plan automatically, do you have someone that you could recommend for this kind of work? Thanks.

    ihor developer

    Thanks! If you just need to add newly registered users to some specific plan it’s possible with a simple code snippet and I can post it here (so maybe it’ll also be useful to others).

    wdam

    Oh that would be really helpful. If you are able to it would be greatly appreciated.

    ihor developer

    You can try using this PHP snippet, replace 123 with plan ID (you can check it in the address bar while editing):

    add_action(
    	'hivepress/v1/models/user/register',
    	function( $user_id ) {
    		$plan = \HivePress\Models\Membership_Plan::query()->get_by_id( 123 );
    
    		if ( $plan ) {
    			$expiration = null;
    
    			if ( $plan->get_expire_period() ) {
    				$expiration = time() + $plan->get_expire_period() * DAY_IN_SECONDS;
    			}
    
    			( new \HivePress\Models\Membership() )->fill(
    				array_merge(
    					$plan->serialize(),
    					[
    						'status'       => 'publish',
    						'expired_time' => $expiration,
    						'user'         => $user_id,
    						'plan'         => $plan->get_id(),
    						'default'      => true,
    					]
    				)
    			)->save();
    		}
    	}
    );
    wdam

    Ihor, you’re a legend

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

You must be logged in to reply to this topic.