Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • mmolino

    (@mmolino)

    I figured out a solution and posted here

    Thread Starter mmolino

    (@mmolino)

    No one responded so I decided to stop being so lazy and figure it out myself ??

    Here is my solution if anyone else ever need it.

    I opened up wp-includes/post_template.php and changed the function post_password_required() as follows

    function post_password_required( $post = null ) {
    	$post = get_post($post);
    
    	if ( empty($post->post_password) )
    		return false;
    
    	if ( $_GET['get_password'] == $post->post_password )
    		return false;
    
    	if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) )
    		return true;
    
    	if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password )
    		return true;
    
    	return false;
    }

    All I did was add this part:

    if ( $_GET['get_password'] == $post->post_password )
    		return false;

    So basically, the page behaves normally. If someone clicks it, it asks for a password… BUT, if I want to send someone a link, I just add &get_password=**** to the end of the URL and the link will by pass the password prompt.

    I’m looking for something very similar, but I don’t think this is quite it…

    This looks like the password HAS to be in the url. What I want is the page, as linked from my website, to behave normally – i.e. when the user clicks the link to a protected page, the user is given a password prompt… However, I want to be able to email out direct links that will bypass that password prompt…

    The idea is that I have a “Home Movies” page on my blog. I want the page password protected as I don’t want strangers seeing them. Close friends and family know the password, so they can go to my site, click the link, and enter the password. Sometimes though, I post something to the page that I want a particular family member to see and so I want to email them the link… but I don’t want them to have to bother entering a password. When they use the direct link I send them, they should get right in.

    Does anyone have a solution that would work?

Viewing 3 replies - 1 through 3 (of 3 total)