Forum Replies Created

Viewing 1 replies (of 1 total)
  • abjardim

    (@abjardim)

    Hi @kycam25,

    did the solution work for you?

    I implemented the code, and it causes an error on the website when I try to log in.
    Not sure what I am doing wrong… would appreciate any help!

    add_filter( 'loggedin_reached_limit', 'custom_loggedin_limit_check', 10, 3 );
    
    function custom_loggedin_limit_check( $reached, $user_id, $count ) {
        // Using the $user_id, check the user's membership level
        // and check if the $count is reached as per the membership.
        // If reached, return true, else return false.
    
        $limits = [
            166 => 1,
            1131 => 1,
            1132 => 3,
        ];
    
        $member = pms_get_member( $user_id );
        $member_plan = $member['subscriptions'][0]['subscription_plan_id'];
    
        if ( $count > $limits[$member_plan] ) 
        {
            $reached = true;
        }
        else
        {
            $reached = false;
        }
    
        return $reached;
    }

    I also just tried writing “if ( $count > 1 )” just to test if the mistake was with the memberships plugin, but it also doesn’t work.

    Thank you!

Viewing 1 replies (of 1 total)