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.
-
AuthorPosts
-
May 8, 2016 at 5:59 pm #6835
abeolezx
ParticipantMy 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 #6837mbrsolution
ModeratorHi, are you saying that after you updated your theme the plugin stopped working in your mobile devices?
May 9, 2016 at 3:29 am #6838abeolezx
ParticipantNo 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 #6839mbrsolution
ModeratorThank you for your reply. The plugin developers will investigate further your issue.
May 9, 2016 at 9:35 am #6840abeolezx
ParticipantOk 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 #6852admin
KeymasterThis 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/ -
AuthorPosts
- You must be logged in to reply to this topic.