Very Simple Filter causing problems
-
I’m trying to make a very simple filter for my sites. It works fine when it is installed, but every time I edit or create a new post, the admin goes to an all white page. And if you are not already logged in, you can’t get to the login page.
Can anyone tell me what I’m doing wrong?
The code for the plugin is below. It basicially looks for 2 variables in the URL. If they exist, it adds them to each link in the content. I’d really appreciate any help I can get on this.
<?php
/*
Plugin Name: Affiliate Info
Plugin URI:
Description: Adds affiliate info to content and commentlinks
Author: Frank Panko
Version: 1.15
Author URI:
*/add_filter(‘the_content’, ‘nat_affiliates’);
add_filter(‘comment_text’, ‘nat_affiliates’);function nat_affiliates($text) {
if(!empty($_REQUEST[‘CLICK’])){
$affiliate_value = $_REQUEST[‘CLICK’];
$click = $affiliate_value;if(!empty($_REQUEST[‘acc’])){
$affiliate_account = $_REQUEST[‘acc’];
$click.=’,,’.$affiliate_account.’,’;
}
}if(!empty($click)){
$text = preg_replace(‘/<a href=”(.*?)”/’,”<a href=\”\\1&CLICK=$click\”” , $text);
}echo trim( $text );
}
?>
- The topic ‘Very Simple Filter causing problems’ is closed to new replies.