Categories
computer support

Sending links to password protected pages in WordPress

Update  16JAN13 – the older post blow  is now invalidated.

The solution you seek is now the Post Password Token plugin, http://top-frog.com/projects/post-password-token/ which is a FREE plugin on WordPress.  Donate $10 if you like it !  I did.

 

Old solution

————————–

So if you are reading this, you already know how to click the password protect button in WordPress. But what you are really wanting to know is how to send a link to someone, with the password option already embedded. Say a client who isn’t going to remember his password.

First, you probably searched WP looking for the #@$! plugin that does this. No luck.
Second, you’ve realized that you’ll have to either install a ‘membership’ style plugin or tweak htpaccess code.
Third, you’ve found my humble musing with a promise of an elegant solution.

Well, i’m hitchhiking off of http://wordpress.org/support/topic/bypass-password-prompt-with-direct-link-to-protected-page
who really solved it, but made a typo just at the finish line and screwed up the answer.

So use your friendly ftp program to log into your website, download the /wp-includes/post-template.php and look for function post_password_required about halfway down.

insert this little snippet near the top.

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

so it looks like

function post_password_required( $post = null ) {
$post = get_post($post);

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

if ( empty($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;
}

SAVE THE FILE locally. On the server, save the old file post-template.php as post-template.php.old (in case you screw up, you can roll back).

UPLOAD the new file post-template.php.

And now send the link as http://www.mysite.com/my-secret-post-which-sucks/?get_password=your-password-here

it pulls up like a public page.  Note that once it pulls up, that I think a cookie is set, and it keeps showing. So you’ll have to test on a 2nd computer that hasn’t entered the password before.

 

Done.

=========

Note! 4/23/12 – WordPress updates will wipe out this file. So you need to save a copy of this file as post-template.php.working and then after an update, replace the post.template with the post-template.php.working after EVERY wordpress update.

==========

BTW, this is really really handy for delivering ebooks from Clickbank so you can control access to the files.

-mt

—————————–

8/1/2012 recent WordPress updates changed this and this solution is no longer valid. now the best thing to do is simply hide the page to deliver the product.

Categories
Uncategorized

Streaming music from FreeNAS to Android

First, you need FreeNAS installed on a server. Then you’ll need to turn on a service (under services) iTunes/DAAP. Config this by selecting your music directory and following the logic of the page. If you installed FreeNAS, this config shouldn’t be an issue.

==update Jan 1, 2014 =====  So FreeNAS is no longer FreeNAS, it is now called NAS4Free and some company has acquired the rights to call their bloated NAS “Freenas” and have the old FreeNAS.org website.  So stick with NAS4Free because it will run on older, weaker hardware and have all these wonderfully mature and stable options like DAAP.

Second, go to the Droid market and download the free DAAP app. Configure it to point to your FreeNAS server and it will read your music library in a minute or so.

That should leave you good to go.

-mt