不少用户反映Tinection主题以及UM插件的验证码无法显示问题,这主要由于验证码使用了自定义字体,部分虚拟主机无法加载使用,可行的解决办法就是关闭验证码以及相应的验证。
1.关闭Tinection主题的验证
首先打开主题的includes/loginbox.php,定位至75行:
将以下代码:
- <p id=“captcha_inline”>
- <input class=“input-control inline” type=“text” id=“tin_captcha” name=“tin_captcha” placeholder=“输入验证码” required>
- <i mg src=“<?php echo THEME_URI.’/images/captcha-clk.png’; ?>” class=“captcha_img inline” title=“点击刷新验证码”>
- <input class=“submit inline” type=“submit” value=“注册” name=“submit”>
- </p>
修改为:
- <p>
- <input class=“submit inline” type=“submit” value=“注册” name=“submit”>
- </p>
再打开主题的functions.php文件,定位至大约1645行:
寻找代码:
- /* 后台注册同时添加验证码
- /* ———————– */
- function tin_add_register_captcha(){
- $captcha = THEME_URI.’/includes/captcha.php’;
- ?>
- <p style=“overflow:hidden;”>
- <label for=“tin_captcha”>验证码<br>
- <input type=“text” name=“tin_captcha” id=“tin_captcha” aria-describedby=“” class=“input” value=“” size=“20” style=“float:left;margin-right:10px;width:190px;”>
- <i mg src=“<?php echo $captcha; ?>” class=“captcha_img inline” title=“点击刷新验证码” onclick=“this.src='<?php echo $captcha; ?>’;” style=“float:right;margin-top: 5px;”></label>
- </p>
- <?php
- }
- add_action(‘register_form’,’tin_add_register_captcha’);
- function tin_add_register_captcha_verify($sanitized_user_login,$user_email,$errors){
- if(!isset($_POST[‘tin_captcha’])||emptyempty($_POST[‘tin_captcha’])){
- return $errors->add( ’empty_captcha’, __( ‘请填写验证码’,’tinection’ ) );
- }else{
- $captcha = strtolower(trim($_POST[‘tin_captcha’]));
- session_start();
- $session_captcha = strtolower($_SESSION[‘tin_captcha’]);
- if($captcha!=$session_captcha){
- return $errors->add( ‘wrong_captcha’, __( ‘验证码错误’,’tinection’ ) );
- }
- }
- }
- add_action(‘register_post’,’tin_add_register_captcha_verify’,10,3);
直接删除即可。
2.UM插件关闭验证
首先打开插件的template/loginbox.php,定位至大约76行:
将以下代码:
- <p id=“captcha_inline”>
- <input class=“input-control inline” type=“text” id=“um_captcha” name=“um_captcha” placeholder=“输入验证码” required>
- <i mg src=“<?php echo UM_URI.’/static/img/captcha-clk.png’; ?>” class=“captcha_img inline” title=“点击刷新验证码”>
- <input class=“submit inline” type=“submit” value=“注册” name=“submit”>
- </p>
修改为:
- <p>
- <input class=“submit inline” type=“submit” value=“注册” name=“submit”>
- </p>
继续打开插件的func/functions.php文件,定位至大约201行:
找到代码:
- /* Add captcha in login page
- /* ————————– */
- function um_add_register_captcha(){
- $captcha = UM_URI.’/template/captcha.php’;
- ?>
- <p style=“overflow:hidden;”>
- <label for=“um_captcha”>验证码<br>
- <input type=“text” name=“um_captcha” id=“um_captcha” aria-describedby=“” class=“input” value=“” size=“20” style=“float:left;margin-right:10px;width:200px;”>
- <i mg src=“<?php echo UM_URI.’/includes/captcha.php’; ?>” class=“captcha_img inline” title=“点击刷新验证码” onclick=“this.src='<?php echo UM_URI.’/includes/captcha.php’; ?>’;” style=“float:right;margin-top: 5px;”></label>
- </p>
- <?php
- }
- add_action(‘register_form’,’um_add_register_captcha’);
- function um_add_register_captcha_verify($sanitized_user_login,$user_email,$errors){
- if(!isset($_POST[‘um_captcha’])||emptyempty($_POST[‘um_captcha’])){
- return $errors->add( ’empty_captcha’, __( ‘请填写验证码’,’um’ ) );
- }else{
- $captcha = strtolower(trim($_POST[‘um_captcha’]));
- session_start();
- $session_captcha = strtolower($_SESSION[‘um_captcha’]);
- if($captcha!=$session_captcha){
- return $errors->add( ‘wrong_captcha’, __( ‘验证码错误’,’um’ ) );
- }
- }
- }
- add_action(‘register_post’,’um_add_register_captcha_verify’,10,3);
直接删除即可。
3.另外可能的解决办法
对于主题请下载captcha.php·Tinection替换主题includes文件夹下同名文件;
对于UM插件请下载captcha.php·UM替换插件template文件夹下同名文件;
如果此替换方法不奏效,只能关闭验证码解决,或者使用VPS主机获得更多的权限。
4.前台投稿不显示可视化编辑工具
这很大程度由于使用的WordPress版本部分翻译文件不全,请按如下方法尝试解决:
打开WordPress根目录的wp-includes/js/tinymce/langs文件夹,将其中的wp-langs-en.js复制一份,重命名为zh.js放置于此文件夹。
此外也有可能是页面存在js错误,请检查解决。