• Resolved demerit

    (@demerit)


    Hi,
    Class MS_Model_Member defines the subscriptions as protected.
    Class MS_Model_Relationship defines the __get magic function, but not __isset.
    The problem then occurs when MS_View_Member_Editor builds the list of fields in prepare_fields_edit(), where this code ALWAYS comes up true for empty(subscription->expire_date) and so the block never triggers.

    // Expire date already reached:
    elseif ( ! empty( $subscription->expire_date ) && strtotime( $subscription->expire_date ) < strtotime( MS_Helper_Period::current_date() ) ) {

    See the notes on the php.net page for the empty() function. If you define __get when the members aren’t public then you also have to define __isset.

    It’s easy to reproduce the problem. Just look at the subscription details page for a member whose subscription has expired. The status choices are not correct.

    This may come up elsewhere too whereever empty() is used in a similar manner.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Predrag – WPMU DEV Support

    (@wpmudev-support1)

    Hey @demerit,

    Thanks a lot for such detailed report, we really appreciate it, I’ll forward this to our developers straight away so they can investigate it further!

    Cheers,
    Predrag

    Thread Starter demerit

    (@demerit)

    Just a quick followup that the lines above that in prepare_fields_edit() where it accesses $user->subscriptions are also part of the problem, since if subscriptions is protected they should be retrieved via some public method.

    And above just to clarify my use of true/false I meant that empty($subscription->expire_date) always evaluates to true, so that the if clause always evaluates to false.

    Plugin Support Predrag – WPMU DEV Support

    (@wpmudev-support1)

    Hi @demerit,

    Thanks for the update, I’ve included this in the previous report.

    Cheers,
    Predrag

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Incorrect status options on subscription details page’ is closed to new replies.