Force users to login before download wordpress
Yet another item that I’ve been looking for and there wasn’t a simple solution. I’ve actually been looking at this for a while then I just realized it would be really simple to write a filter.
If you own wordpress and you want to make sure that your users login/register before downloading .zip files, or any files if you want to customize it, the check this out.
- Protects your links, promotes website user-base growth
- Isn’t more than you need, no file management just pure href swapping
How to install
- Take the following function a put it in your formatting.php file located in wp-admin
- go into default-filters.php and put this around line 111 add_filter(’the_content’, ‘linkcheck’);
- replace the “http://www.hawkenterprises.org” with the location of your login file.
function linkcheck($text){
if(!is_user_logged_in()){
return preg_replace(’/<a\shref=\”([^\"]*.zip)\”>(.*)<\/a>/’,'<a href=”http://www.hawkenterprises.org/wp-login.php”>$2</a> (Requires Login)’,$text);
}else{
return $text;
}
}
That’s it, We will probably make a wordpress plugin out of it soon but this should help all you who want to force users to register.
No Comments yet »
RSS feed for comments on this post. TrackBack URI
Leave a comment
You must be logged in to post a comment.















