• Resolved Biyans

    (@biyanpasau)


    Hello,

    Is there a way to check if membership account is expired? I’m looking for conditional statement similar to this:

    <?php if (SwpmMemberUtils::is_member_logged_in()) { ?>

    Can you assist?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support mbrsolution

    (@mbrsolution)

    Hi,

    The following code snippet will retrieve the expiry date of the member who is logged into the site and viewing the page:

    <?php
    if(SwpmMemberUtils::is_member_logged_in()) {
        $auth = SwpmAuth::get_instance();
        $expiry_date = $auth->get_expire_date();
        echo "Expiry date: ".$expiry_date;
    }
    else{
        echo "You are not logged-in as a member";
    }
    ?>

    Kind regards.

    Thread Starter Biyans

    (@biyanpasau)

    I think I didn’t explain my question very detail. What I’m trying to do is to show certain content only for expired member. For example:

    <?php if account_is_expired() {
      echo 'Only expired account can see this text';
    } else {
      echo 'Text only for active member';
    } ?>

    How do i do that on this plugin?

    Plugin Support mbrsolution

    (@mbrsolution)

    Thank you for providing more information. I think the following addon is what you are looking for. It has a shortcode for expired members.

    https://simple-membership-plugin.com/apply-partial-section-protection/

    Let me know if this works for you.

    Kind regards.

    Thread Starter Biyans

    (@biyanpasau)

    Exactly what I need. Thank you!

    Plugin Support mbrsolution

    (@mbrsolution)

    You are most welcome ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Conditional statement to check if membership expired’ is closed to new replies.