admin管理员组文章数量:1426648
i have the following Problem and i have no ideas left. I try to explain: We have some Producttests you need to register for. A Post can be a Producttest, wich is indicated by a checkbox in the editscreen. So if the checkbox is checked there will be a formular attached to the post via the_content filter. Works fine till then. After register an opt-in email is being send to the user for activating himself. And here is the Problem: for the activation url i attached the users email, a generated key and a action variable. I just generate the string and put it in the email. The logic for activation is in the_content filter either. It looks like this:
public function post_show_form( $content ) {
if( !is_single() ) return $content;
$file = 'form';
if( !( $val = get_post_meta( get_the_id(), 'is_producttest', TRUE ) ) ) return $content;
if( isset( $_GET[ 'optin_produkttest' ] ) && !empty($_GET[ 'optin_produkttest' ]) ) {
if( $this->model->already_registered( $_GET[ 'email' ] ) ) {
if( $this->model->activate( $_GET[ 'email' ], $_GET[ 'regkey' ] ) ) {
if( function_exists( 'activate_user_in_cr' ) ) {
activate_user_in_cr( $_GET[ 'email' ] );
}
return '<h1>Success</h1>' . $content;
}
} else {
return $content . '<h1>Error</h1>';
}
} else {
$start_date = new \DateTime(get_field( 'form_test_startdate', FALSE, FALSE ));
$end_date = new \DateTime(get_field( 'form_test_enddate', FALSE, FALSE ));
$now_date = new \DateTime(date( "Ymd"));
if( $now_date < $start_date){
$file = 'form';
}else{
if( $now_date < $end_date ){
$file = 'running';
} else{
$file = 'expired';
}
}
return $content . $this->view->get_template( $file );
}
}
The problem: the user is always activated immediatly and the "isset( $_GET[ 'optin_produkttest' ] ) && !empty($_GET[ 'optin_produkttest' ])" is always set and they have the right values but i dont set them, EVER. How come they are set anyway. How is that possible, i dont understand it at all.
I hope you understand what i mean, if not ask please. I need to fix this.
Thanks
本文标签: pluginsWordpress thecontent Filter and GET Parameter
版权声明:本文标题:plugins - Wordpress the_content Filter and GET Parameter 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745460291a2659293.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论