I’m looking for a way to store a password using a channel field, then use that field to hide content until the user enters in the password to display the hidden content.
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
November 15, 2012 9:52am
Subscribe [1]#1 / Nov 15, 2012 9:52am
I’m looking for a way to store a password using a channel field, then use that field to hide content until the user enters in the password to display the hidden content.
#2 / Nov 16, 2012 12:51pm
Thanks for moving this. I thought about it only after I posted. 😊
#3 / Nov 18, 2012 12:17am
I recently ran across this article explaining how to create password protected content using the url as the password. http://eeinsider.com/articles/password-protected-content-made-simple/
What I would like to achieve is something like this only using a channel field as the password.
Could I store a password using a hidden field and channel field combined as a means to allow a specific password to be assigned to the private content?
<h2>View Calendar</h2>
<p><?php<br />
global $IN;<br />
$the_password = $this->EE->input->post('the_password');<br />
if ( ! $the_password ) :<br />
?></p>
<p><form action="" method="post"><br />
<br />
Enter your password:<br><br />
<input type="password" name="the_password" value="" id="the_password" /><br />
<input type="submit" name="submit" value="Access Content →" id="submit" /><br />
<br />
</form></p>
<p><?php else : ?><br />
{exp:channel:entries channel="calendar" url_title="<?php echo $the_password;?>" dynamic="no" limit="1"}<br />
{if no_results}<br />
Your password is incorrect. Would you like to <a href="http://{path=/teachers/comments/}">try again</a>?<br />
{/if}<br />
{if avatar_calendar != ""}<br />
<div class="profile-img picture-profile"> {avatar_calendar}</div><br />
{if:else}<br />
<div class="header-wrapper"><br />
<h1>Calendar</h1><br />
<a href="#" class="tickets" target="_blank" rel="noopener"><span>Purchase Lessons</span></a> </div><br />
{/if}<br />
<div class="post-title"><br />
</p><h2><a href="http://{comment_url_title_auto_path}">{teacher_calendar}</a> </h2>
<p> </div><br />
{calendar_body}<br />
<hr><br />
<iframe src="{private_content}" width="600" height="600" frameborder="0" scrolling="no"></iframe><br />
{/exp:channel:entries}<br />
<?php endif; ?>