Forum Replies Created
-
AuthorPosts
-
June 10, 2015 at 2:23 pm in reply to: Restrict access to page template for certain types of users #155769tsahilMember
Jamie,
That worked like a charm - just the thing I needed.
Thanks!
June 9, 2015 at 11:56 am in reply to: Restrict access to page template for certain types of users #155598tsahilMemberWhy not?
I still want my template to appear - the header, the footer, the whole page.
I just want to replace the content with an explanation and a short login form (or a link to login).June 9, 2015 at 2:53 am in reply to: Restrict access to page template for certain types of users #155537tsahilMemberHere you go: https://gist.github.com/anonymous/e15c9a615f938889b550
I am not sure what filter to add/remove to get what I need done into this file.
June 9, 2015 at 2:21 am in reply to: Restrict access to page template for certain types of users #155528tsahilMemberI don't have an issue knowing the user. For that, I used the following condition:
if($user>0 && get_user_meta($user,'premium_subscriber',true))
What I am looking for is to be able to place it in the page template at the correct place - somewhere that comes before WordPress writes the content of the page itself and enables me to replace it with some other text.
As for password protection, this won't work, as I have a few pages like that and I want the users to be able to move between them without needing to click passwords all over the place.
June 9, 2015 at 2:04 am in reply to: Restrict access to page template for certain types of users #155521tsahilMemberThanks all.
I probably wasn't clear enough with my problem. I know how to check the user's type.
My problem is in finding which filter to add and how to start it off.I am writing a page template in my child theme.
It looks like this for the most part:<?php /* Template Name: Book Page */ ?> <?php add_filter('genesis_pre_get_option_site_layout', '__genesis_return_full_width_content'); genesis(); ?>
What additional filter should I add and what should I place in it in order for the following to happen:
1. If a user is an admin or a certain type (new custom type that I added), then he should see the content.
2. If the user doesn't fit the criteria above, I show him something like "This page is only available for people who subscribe for ABC. Please login using the form below".Thanks a bunch.
June 8, 2015 at 9:41 am in reply to: Restrict access to page template for certain types of users #155378tsahilMemberThanks Jamie.
These look like overkill to what I am looking for.
I just need the code snippet to put in a single page template - putting a bloated members plugin is the last thing I want to do at the moment... -
AuthorPosts