Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在DWQA(wordpress插件)中询问而不登录或输入电子邮件_Php_Wordpress - Fatal编程技术网

Php 在DWQA(wordpress插件)中询问而不登录或输入电子邮件

Php 在DWQA(wordpress插件)中询问而不登录或输入电子邮件,php,wordpress,Php,Wordpress,在wordpress插件中,用户如何在不注册或输入电子邮件地址的情况下添加问题 我希望所有的userguest都能够在不输入电子邮件地址甚至不注册的情况下提问。我也遇到了同样的问题,我刚刚解决了这个问题 DWQA版本1.3.3 你必须替换这个函数 function dwqa_require_field_submit_question() 用你自己的版本。您可以在plugin文件夹中的template-functions.php的第79行找到旧函数 仅从队列中删除该函数将无法添加新问题。因此,

在wordpress插件中,用户如何在不注册或输入电子邮件地址的情况下添加问题


我希望所有的userguest都能够在不输入电子邮件地址甚至不注册的情况下提问。

我也遇到了同样的问题,我刚刚解决了这个问题

DWQA版本1.3.3

你必须替换这个函数

 function dwqa_require_field_submit_question()
用你自己的版本。您可以在plugin文件夹中的template-functions.php的第79行找到旧函数

仅从队列中删除该函数将无法添加新问题。因此,只需将调整后的函数版本添加到主题文件夹中的functions.php中,然后删除标准函数并添加调整后的函数

将以下内容添加到functions.php中:

function dwqa_require_field_submit_question_adjusted(){
?>
<input type="hidden" name="dwqa-action" value="dwqa-submit-question" />
<?php wp_nonce_field( 'dwqa-submit-question-nonce-#!' ); ?>

<?php  
    $subscriber = get_role( 'subscriber' );
?>
<?php if ( ! is_user_logged_in() && ! dwqa_current_user_can( 'post_question' ) ) { ?>
<input type="hidden" name="login-type" id="login-type" value="sign-up" autocomplete="off">
<div class="question-register clearfix">
    <label for="user-email"><?php _e( 'You need an account to submit question and get answers. Create one:','dwqa' ) ?></label>
    <div class="register-email register-input">
        <input type="text" size="20" value="" class="input" placeholder="<?php _e( 'Type your email','dwqa' ) ?>" name="user-email">
    </div>
    <div class="register-username register-input">
        <input type="text" size="20" value="" class="input" placeholder="Choose an username" name="user-name-signup" id="user-name-signup">
    </div>
    <div class="login-switch"><?php _e( 'Already a member?','dwqa' ) ?> <a class="credential-form-toggle" href="<?php echo wp_login_url(); ?>"><?php _e( 'Log In','dwqa' ) ?></a></div>
</div>

<div class="question-login clearfix dwqa-hide">
    <label for="user-name"><?php _e( 'Login to submit your question','dwqa' ) ?></label>
    <div class="login-username login-input">
        <input type="text" size="20" value="" class="input" placeholder="<?php _e( 'Type your username','dwqa' ) ?>" id="user-name" name="user-name">
    </div>
    <div class="login-password login-input">
        <input type="password" size="20" value="" class="input" placeholder="<?php _e( 'Type your password','dwqa' ) ?>" id="user-password" name="user-password">
    </div>
    <div class="login-switch"><?php _e( 'Not yet a member?','dwqa' ) ?> <a class="credential-form-toggle" href="javascript:void( 0 );" title="<?php _e( 'Register','dwqa' ) ?>"><?php _e( 'Register','dwqa' ) ?></a></div>
</div>
<?php } else if ( ! is_user_logged_in() && dwqa_current_user_can( 'post_question' ) ) { ?>
//Here was the old code which had shown the E-mail input and login information
<?php  }
}
现在只需删除旧函数并将新函数添加到functions.php中的队列中:

remove_action( 'dwqa_submit_question_ui', 'dwqa_require_field_submit_question' );
add_action( 'dwqa_submit_question_ui', 'dwqa_require_field_submit_question_adjusted' );
就是这样:。也许不是最好的方法,但它可以避免更改插件代码


祝您度过愉快的一天

欢迎来到Stack Overflow!感谢您提供此代码片段,它可能会提供一些有限的短期帮助。通过说明为什么这是一个很好的问题解决方案来正确解释它的长期价值,并将使它对未来有其他类似问题的读者更有用。请在您的回答中添加一些解释,包括您所做的假设。
//Removes BuddyBar from non-admins only
function splen_remove_admin_bar() { if( !is_super_admin() )
add_filter( ‘show_admin_bar’, ‘__return_false’ );
}
add_action(‘wp’, ‘splen_remove_admin_bar’);
//Removes BuddyBar from non-admins only
function splen_remove_admin_bar() { if( !is_super_admin() )
add_filter( ‘show_admin_bar’, ‘__return_false’ );
}
add_action(‘wp’, ‘splen_remove_admin_bar’);