Community Forums › Forums › Archived Forums › General Discussion › Hiding content in a custom Membership Genesis site
Tagged: gatekeeping, membership
- This topic has 3 replies, 2 voices, and was last updated 10 years, 3 months ago by jdcohan.
-
AuthorPosts
-
October 15, 2014 at 4:44 pm #127929jdcohanMember
I need to find a way to hide content from visitors who have not signed into a custom-built sign-in area. (Note that I am _not_ using the WordPress login system for this gatekeeping.)
I'm working on a Genesis (genesis-sample child theme) site that utilizes custom members-only gatekeeping via custom functions in the mu-plugins directory. The gatekeeping is based on the presence and values of PHP session variables that are set when a member signs in via the custom sign-in form I've created.
(BTW, I opted for a custom-built membership system after seriously considering s2Member and determining - in collaboration with s2Member's creators - that it would not meet the requirements.)
For all those site pages that are based on custom templates I've created, it's easy: a visitor who has not signed into the custom membership system will see a warning message (e.g., "Sorry, you don't have sufficient privileges to view this content"). There's some relatively simple conditional PHP code that checks session variables. (Essentially, the code checks to see if the session variable for "logged_in" is (a) set and (b) true.)
My question: How to implement this gatekeeping on pages that are based on standard Genesis page templates.
If this were a site built on twentytwelve, for example, I'd just insert my conditional scripting in a copy of "content-page.php" file and store it in my child theme directory. But with Genesis, I'm having trouble understanding where and how to do what I need to do.
Please be assured that I'm posting this only AFTER having spent considerable time researching Genesis building blocks (actions and filters; Genesis Simple Hooks; etc.) via StudioPress resources such as Code Snippets, Tutorials, Community Resources, and, yes, the Beginners Guide.
I'm sure I'll need to provide more info if anyone is game and kind enough to help me down this path. Thanks in advance.
Jeff Cohan
October 16, 2014 at 12:42 am #127963Brad DaltonParticipantHave you tried using conditional tags and hooks?
What code are you using?
October 21, 2014 at 9:48 am #128653jdcohanMemberBrad -
a) Which tags and hooks to use was my quandary.
b) Simple conditional php code testing the presence and values of auth-related session variables.Update: I have things working now via a simple custom page template for protected pages whereby the conditional php code shows the protected content to signed-in members and an error message to any others.
October 21, 2014 at 2:47 pm #128684jdcohanMemberNew, related challenge:
All blog posts (and blog archive pages) on this site need to be protected. If a certain session variable is set and true, a visitor will see the content. Otherwise the visitor would see a "Not-authorized" message.
I've got the session variable stuff taken care of, and I've got this working for single blog posts and static pages.
My question: How would you folks do this for archives?
TIA,
Jeff -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.