Support » Plugin: Membership 2 » Registered – payed users with correct member fields are not able to access

  • Resolved Frumph

    (@frumph)


    A couple random users that have say “member” “member” with paypalxprs like all the other accounts that are exactly the same cannot use the same access level (doesn’t pass check?) for some reason, while everyone else is fine.

    Is there something i’m missing, the accounts look exactly the same as working ones, what else (maybe hidden?) that could the plugin be checking?

    Guy has 6 months left of a year long subscription and the plugin thinks they are members but the site is acting as if they’re not-subscribed ..

    Also I cannot find a screen that is showing sub start dates and end dates on peoples user info where is that?

Viewing 3 replies - 1 through 3 (of 3 total)
  • basically registered users in a paid membership couldn’t see protected content

    — solved —

    Bad logic in the ms_has_membership() and associated functions that check for if the user is in an appropriate membership continues to return a value of false.

    This makes it so people in memberships cannot see protected content because of bad logic gate.

    Because of this bad logic, the horribly not-so-intuitive controls of the protection rules needed to be adjusted.

    Without having a ‘visitor’ membership that includes not-logged-in users and logged in users that are not in any other memberships no matter what you do it returns false.

    —————–

    So – a default visitors membership should be added to the code base to solve this for everyone else who also updated from old membership that didn’t have a ‘default’, and even then the ‘default’ needs to include logic for logged in users that are not in any other memberships.

    — NOTE: This made the capabilities add-on also fail it’s logic

    Added fix for (my) usage for having paid memberships become contributors and then back down again if they are not paid. (if anyone is so inclined to want an example of how-to switch from subscriber to contributor based on a certain membership – adjust membership # and roles to what your needs are.

    
    if (function_exists('ms_has_membership')) {
    	$current_user = wp_get_current_user();
    	if ($current_user->ID) {
    		if ( ms_has_membership(18017) ) {
    			if (in_array( 'subscriber', (array)$current_user->roles )) {
    				$current_user->remove_role('subscriber');
    				$current_user->add_role('contributor');
    			}
    		} elseif (in_array( 'contributor', (array)$current_user->roles)) {
    			$current_user->remove_role('contributor');
    			$current_user->add_role('subscriber');
    		}
    	}
    }
    
    • This reply was modified 2 years, 5 months ago by  Frumph. Reason: fixed [code] to `
    • This reply was modified 2 years, 5 months ago by  Frumph.

    Extra non-existant membership from old membership install

    Here is an image showing the extra membership – this membership [member] does *not* exist in membership 2 and so it’s still seeing it AND using it for peoples ms_has_membership() which causes protected content to fail being seen.

    — Also note the additional bug of the start date and end date’s are all the day that they were imported and *not* the proper ones they are supposed to be.

    • This reply was modified 2 years, 5 months ago by  Frumph.
    Plugin Author jdailey

    (@jdailey)

    Thank you for the feedback and fix. I will pass this along to our developers.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Registered – payed users with correct member fields are not able to access’ is closed to new replies.