[wp-hackers] dynamic post passwords

Glenn Ansley glenn at glennansley.com
Sun Nov 1 20:38:12 UTC 2009


I have a plugin that automatically assigns passwords to children pages
if the password is set for the parent page.
I encountered several obstacles because of the way the output is
returned. It's been a while so I honestly can't remember what the
specific problems I had were and how I got around it... but here's the
source code in the event it helps you out or gives you a better idea.
I do remember that my plugin doesn't apply the password to
grandchildren pages, just children pages, just fyi.

Hope it helps.

http://fullthrottledevelopment.com/password-protect-children-pages
Source Code: http://svn.wp-plugins.org/ft-password-protect-children-pages/trunk/ft-password-protect-children-pages.php

Glenn Ansley
http://fullthrottledevelopment.com
http://twitter.com/glennansley
http://twitter.com/full_throttle

On Sun, Nov 1, 2009 at 3:28 PM,  <netkickstart at gmail.com> wrote:
> I just had another idea on this (sorry if anyone responded already;
> I'm on the digest version).  How about checking $_POST['post_password']
> in the init hook and, if it passes the dynamic password test, assuming
> we know the $post in that context, the wp-postpass_ cookie could then
> be set to match the post's password as stored in the db.  In this way,
> post_password_required would return false and the post would be shown.
>
> -Erin
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list