hawk enterprises portfolio
hawk enterprises portfolio
hawk enterprises portfolio
hawk enterprises portfolio
hawk enterprises portfolio
hawk enterprises portfolio
hawk enterprises portfolio
hawk enterprises portfolio
hawk enterprises portfolio
hawk enterprises portfolio
hawk enterprises portfolio
hawk enterprises portfolio
hawk enterprises portfolio
hawk enterprises portfolio








counter
Select Country/Language FrancaisDeutschEspanolItalianoPortugeseJapaneseKoreanChineseArabicRussianEnglish
Current Projects
portland paranormal.com
xxk search
battlenow
bighawk casino
Hawk Enterprises News

Force users to login before download wordpress

Tags: , , by Hawk on 04.21.08 1:55 am

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

  1. Take the following function a put it in your formatting.php file located in wp-admin
  2. go into default-filters.php and put this around line 111  add_filter(’the_content’, ‘linkcheck’);
  3. 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.