Membership Plugin

WordPress Membership Plugin

  • Home
  • Documentation
  • Addons
  • Support
    • Quick Setup
    • Documentation
    • Premium Addon Support
    • Paid Support
    • Support Forum
    • Support Forum Search
    • Forum Login
    • Forum Registration
  • Contact

Restriction fails on Mobile Theme after latest Update

Simple Membership Plugin › Forums › Simple Membership Plugin › Restriction fails on Mobile Theme after latest Update

  • This topic has 5 replies, 3 voices, and was last updated 10 years, 6 months ago by admin.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • May 8, 2016 at 5:59 pm #6835
    abeolezx
    Participant

    My code in the Single.php page of my mobile theme looks as follows. It was working perfectly before the recent update, however after the latest update it is not restricting content access.

    MY wordpress has also been updated to 4.5. The non-mobile template works fine without the hardcode using the off-the-self plugin features.

    U used to the following code within my mobile single page…

    global $post;
    $post_id = $post->ID;
    $access_ctrl = SwpmAccessControl::get_instance();
    if ($access_ctrl->can_i_read_post($post_id)){

    $post_content = get_the_content();

    echo str_replace(“\n”,”<br />”,htmlentities($post_content, ENT_QUOTES, ‘UTF-8′));
    } else {

    echo shorten($excerpt, 90);
    echo'</br> </br>’;
    echo’ <div class=”swpm-custom-expired-msg”>To Read the Full Story Sign In</div>’;
    echo'</br> </br>’;
    echo do_shortcode(“[swpm_login_form]”);
    }

    May 8, 2016 at 8:56 pm #6837
    mbrsolution
    Moderator

    Hi, are you saying that after you updated your theme the plugin stopped working in your mobile devices?

    May 9, 2016 at 3:29 am #6838
    abeolezx
    Participant

    No After the latest update of the Simple Membershio Plugin. I just noticed it is not just the mobile theme. I have an snippet with the conditional statement that checks SwpmAccessControl::get_instance() on the main theme as well, that condition is not working as well.

    $access_ctrl = SwpmAccessControl::get_instance();
    if (!($access_ctrl->can_i_read_post($postid))){ ?>

    //[embeded image code removed after checking it]

    <?php }

    I cant see the image loading.

    May 9, 2016 at 5:47 am #6839
    mbrsolution
    Moderator

    Thank you for your reply. The plugin developers will investigate further your issue.

    May 9, 2016 at 9:35 am #6840
    abeolezx
    Participant

    Ok Thank you.

    One more thing, i aquired an SSL cerificate and added it to my site a week ago. Now even logged in users do not get to see restricted contents automatically.

    i have to remove the (s) from https:// and enforce http:// manually on a given article to access restricted contents.

    Please look into the matter or advise me on how to proceed.

    Thank you

    May 10, 2016 at 7:54 am #6852
    admin
    Keymaster

    This plugin is fully compatible with SSL certificate. I am personally using it myself with an SSL enabled site of mine. Before you use an image, make sure to enter the FULL URL of that image in the browser’s address bar to verify that it can load correctly. If you enter a WRONG or inaccessible URL in your custom code, that image won’t load.

    Your custom code needs to be updated a little. We had to make a change in the plugin code when we added the new features in the last version.

    Below is an example of how your updated custom code should look like:

    
    global $post;
    $access_ctrl = SwpmAccessControl::get_instance();
    if ($access_ctrl->can_i_read_post($post)){
        //This user can read the specified post
        //Add your custom code that does something
    }
    

    This has been updated in our documentation but you were probably seeing a cached version of the page:
    https://simple-membership-plugin.com/simple-membership-miscellaneous-php-tweaks/

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Log In

Please read this message before using our plugin.

Search

Featured Addons and Extensions

  • Membership Form Builder Addon
  • Member Directory Listing Addon
  • WooCommerce Payment Integration
  • Member Data Exporter Addon

Documentation

  • Documentation Index Page

Copyright © 2026 | Simple Membership Plugin | Privacy Policy