Simple Membership Plugin › Forums › Simple Membership Plugin › Protection not working for page created with custom page template
Tagged: protection not working
- This topic has 1 reply, 2 voices, and was last updated 8 years, 11 months ago by
mbrsolution.
-
AuthorPosts
-
December 24, 2017 at 8:38 pm #12785
santha26
ParticipantHi, thanks for your wonderful free plugin.
I have a WordPress site which has pages with a custom page template. I tried to protect these pages with your plugin but it doesn’t work. Protection working for all pages & posts created from WordPress dashboard.
I am using the Twenty_Fifteen theme.
I just removed this line <?php the_content(); ?> from default template and added my own php code to display some data from another database in my site. At this point, my custom data are displaying without protection.
So I tried without removing this line <?php the_content(); ?> from custom page template. Now the default protection message “You need to login to view this content. Please Login. Not a Member? Join Us” showing just above my own data from the database.(Protection works, but also displaying data which I want to protect)
So, where should I put my own php code which need to protect?
Here is my custom page template code
<?php
/**
* The template used for displaying custom page content
*
*/
?><article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
<?php
// Post thumbnail.
twentyfifteen_post_thumbnail();
?><header class=”entry-header”>
<?php the_title( ‘<h1 class=”entry-title”>’, ‘</h1>’ ); ?>
</header><!– .entry-header –><div class=”entry-content”>
<?php the_content(); ?><?php
/**
My own php code to display some data from another database in my site
**/?>
<?php
wp_link_pages( array(
‘before’ => ‘<div class=”page-links”><span class=”page-links-title”>’ . __( ‘Pages:’, ‘twentyfifteen’ ) . ‘</span>’,
‘after’ => ‘</div>’,
‘link_before’ => ‘<span>’,
‘link_after’ => ‘</span>’,
‘pagelink’ => ‘<span class=”screen-reader-text”>’ . __( ‘Page’, ‘twentyfifteen’ ) . ‘ </span>%’,
‘separator’ => ‘<span class=”screen-reader-text”>, </span>’,
) );
?>
</div><!– .entry-content –><?php edit_post_link( __( ‘Edit’, ‘twentyfifteen’ ), ‘<footer class=”entry-footer”><span class=”edit-link”>’, ‘</span></footer><!– .entry-footer –>’ ); ?>
</article><!– #post-## –>
December 26, 2017 at 9:49 am #12787mbrsolution
ModeratorHi, have you tested the following addon? In you haven’t, can you test this addon. Let me know how you go.
Thank you
-
AuthorPosts
- You must be logged in to reply to this topic.