安装教程:
1.将附件的adddata.php文件上传至主题pages文件夹内;
2.进入后台-页面-新建页面,在页面属性-模板选择资料补充,然后发布,记录下该页面网址;
<?php
/**
* template name:
*/
get_header();
global $current_user;
$_uavtype = (get_user_meta($current_user->ID, 'user_avatar_type', true));
if(substr($current_user->user_email,-7) != "@no.com"){
echo "<script>location.href='/user'</script>";
}
?>
<div class="container" >
<div class="row">
<main class="site-main" style="width:100%;">
<div class="login" >
<div class="col-xs-12 col-sm-12 col-md-12" style=" margin-bottom: 30px; ">
<!-- 默认 上传 -->
<span class="btn avatarinfo">
<label for="type-gravatar">
<img src="<?php echo _get_user_avatar_url('gravatar')?>" class="mr-2">
<a class="upload"><i class="fa fa-camera"></i><input type="file" name="addPic" id="addPic" accept=".jpg, .gif, .png" resetonclick="true" data-nonce="<?php echo $wp_create_nonce; ?>">
</label></a>
<input type="radio" id="type-gravatar" name="user_avatar_type" value="gravatar" <?php echo $_uavtype=='gravatar' ? 'checked' : '';?>><label for="type-gravatar">默认</label>
</span>
<?php if(_is_bind_openid('qq')): ?>
<!-- QQ -->
<span class="btn avatarinfo">
<label for="type-qq">
<img src="<?php echo _get_user_avatar_url('qq')?>" class="mr-2">
</label>
<input type="radio" id="type-qq" name="user_avatar_type" value="qq" <?php echo $_uavtype=='qq' ? 'checked' : '';?>><label for="type-qq">QQ</label>
</span>
<?php endif; ?>
<?php if (_is_bind_openid('weixin') || _is_bind_openid('mpweixin')): ?>
<!-- 微信 -->
<span class="btn avatarinfo">
<label for="type-weixin">
<img src="<?php echo _get_user_avatar_url('weixin')?>" class="mr-2">
</label>
<input type="radio" id="type-weixin" name="user_avatar_type" value="weixin" <?php echo $_uavtype=='weixin' ? 'checked' : '';?>><label for="type-weixin">微信</label>
</span>
<?php endif; ?>
<?php if (_is_bind_openid('weibo')): ?>
<!-- 微博 -->
<span class="btn avatarinfo">
<label for="type-weibo">
<img src="<?php echo _get_user_avatar_url('weibo')?>" class="mr-2">
</label>
<input type="radio" id="type-weibo" name="user_avatar_type" value="weibo" <?php echo $_uavtype=='weibo' ? 'checked' : '';?>><label for="type-weibo">微博</label>
</span>
<?php endif; ?>
</div>
<input name="nickname" id="nickname" type="text" class="sinput" value="<?php echo $current_user->nickname;?>" placeholder="*昵称" />
<input name="email" id= "email" type="text" class="sinput" placeholder="*邮箱"/>
<?php if (_cao('is_user_bang_email')): ?>
<div>
<input type="text" name="edit_email_cap" class="sinput" id="edit_email_cap" value="" placeholder="*邮箱验证码">
<span style="position: absolute;right: 20px;padding: 1px;">
<button class="btn edit_email_cap" type="button">发送</button>
</span></div>
<?php endif; ?>
<input name="phone" id ="phone" type="text" class="sinput" placeholder="手机号码" />
<input name="qq" id ="qq" type="text" class="sinput" placeholder="QQ号码" />
<button type="button" etap="edit_info" class="button" style="float:right;">提交信息</button>
</div>
<div class="svgdiv">
<div id="body-wrap">
<!--线条-->
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<div class="star"></div>
<!--卡通火箭-->
<div class="rocket">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 511.999 511.999" style="enable-background:new 0 0 511.999 511.999;" xml:space="preserve">
<path style="fill:#FFE470;" d="M206.047,392.377c-4.5,17.404-13.801,33.906-27.304,47.409
c-31.206,30.906-146.653,67.741-159.555,71.641c-5.102,1.5-10.802,0-14.702-3.901s-5.403-9.602-3.901-15.003
c3.901-12.601,41.034-127.751,71.938-158.955c13.502-13.502,30.005-22.804,47.409-27.306l42.907,42.909L206.047,392.377z"/>
<g>
<path style="fill:#FFD400;" d="M162.84,349.172l43.207,43.205c-4.5,17.404-13.801,33.906-27.304,47.409
c-31.206,30.906-146.653,67.741-159.555,71.641c-5.102,1.5-10.802,0-14.702-3.901L162.84,349.172z"/>
<path style="fill:#FFD400;" d="M167.942,365.373l-42.308,42.606c-3,2.701-6.9,4.201-10.501,4.201c-3.901,0-7.801-1.5-10.803-4.201
v-0.3c-5.701-6-5.701-15.303,0-21.003l42.608-42.308c5.701-6.001,15.003-6.001,20.704,0h0.3
C173.941,350.071,173.941,359.672,167.942,365.373z"/>
</g>
<path style="fill:#FDBF00;" d="M167.942,344.37c6,5.701,6,15.303,0,21.004l-42.308,42.606c-3,2.701-6.9,4.201-10.501,4.201
c-3.901,0-7.801-1.5-10.803-4.201v-0.3l63.312-63.311L167.942,344.37L167.942,344.37z"/>
<path style="fill:#FF7816;" d="M174.454,147.549c-106.552,0-140.178,90.082-142.876,93.092c-2.344,4.645-2.124,10.183,0.615,14.621
c2.725,4.439,7.56,7.149,12.775,7.149c61.578,5.445,100,8.842,96.93,8.57l51.03-123.434h-18.474V147.549z"/>
<path style="fill:#FF4B00;" d="M241.013,369.921c0.233,3.073,7.754,102.226,7.267,95.802c0,11.172,11.801,18.41,21.772,13.391
c3.004-2.692,93.092-36.96,93.092-142.876v-18.475L241.013,369.921z"/>
<path style="fill:#FF9F00;" d="M253.155,386.976c-15.902,8.102-31.805,15.904-46.808,23.405c-5.701,3-12.601,1.8-17.404-2.701
l-84.614-84.614c-4.5-4.8-5.701-11.701-2.699-17.402c7.501-15.003,15.303-30.906,23.403-46.808
c4.802-9.302,39.607,11.402,44.409,1.8l81.913,81.913C241.753,347.369,262.457,382.176,253.155,386.976z"/>
<path style="fill:#FF7816;" d="M253.155,386.976c-15.902,8.102-31.805,15.904-46.808,23.405c-5.701,3-12.601,1.8-17.404-2.701
l-42.306-42.306l63.911-63.611l40.807,40.807C241.753,347.369,262.457,382.176,253.155,386.976z"/>
<path style="fill:#ECECF1;" d="M499.497,149.037c-13.502,51.61-37.806,93.616-75.614,129.923
c-44.107,42.606-114.62,79.813-170.729,108.017l-63.911-63.911l-64.211-64.21c28.205-56.11,65.413-126.923,108.019-170.729
c36.305-37.806,78.313-62.111,129.923-75.614l30.303,11.102c0.601,26.104,11.102,49.809,28.205,66.91
c17.103,17.103,40.808,27.606,66.912,28.205L499.497,149.037z"/>
<path style="fill:#E2E2E7;" d="M499.497,149.037c-13.502,51.61-37.806,93.616-75.614,129.923
c-44.107,42.606-114.62,79.813-170.729,108.017l-63.911-63.911l232.239-232.54c17.103,17.103,40.808,27.606,66.912,28.205
L499.497,149.037z"/>
<path style="fill:#76E2F8;" d="M380.076,131.933c-29.104-29.104-76.813-29.104-105.917,0c-29.106,29.406-29.106,76.514,0,105.919
v0.3c29.104,29.104,76.813,29.104,105.917,0C409.482,208.746,409.482,161.34,380.076,131.933z"/>
<path style="fill:#FF9F00;" d="M499.497,149.037c-2.401,0-9.302-0.3-11.702-0.3c-34.507-0.599-65.11-14.401-87.614-36.905
c-22.504-22.504-36.307-53.11-36.907-87.614c0-2.401-0.298-9.302-0.298-11.702C405.582,1.413,453.289-1.288,497.098,0.512
c3.901,0,7.501,1.501,10.203,4.201c2.699,2.701,4.2,6.302,4.2,10.203C513.298,58.72,510.299,106.429,499.497,149.037z"/>
<path style="fill:#5A5A5A;" d="M252.554,280.459c-5.701,6.001-15.301,6.001-21.003,0c-6.001-5.701-6.001-15.303,0-21.004
c5.701-6,15.301-6,21.003,0C258.556,265.155,258.556,274.758,252.554,280.459z"/>
<path style="fill:#FF7816;" d="M499.497,149.037c-2.401,0-9.302-0.3-11.702-0.3c-34.507-0.599-65.11-14.401-87.614-36.905
L507.299,4.713c2.699,2.701,4.2,6.302,4.2,10.203C513.298,58.72,510.299,106.429,499.497,149.037z"/>
<path style="fill:#25D9F8;" d="M380.076,238.152c-29.104,29.104-76.813,29.104-105.917,0v-0.3l105.917-105.919
C409.482,161.34,409.482,208.746,380.076,238.152z"/>
<path style="fill:#444444;" d="M252.554,280.459c-5.701,6.001-15.301,6.001-21.003,0l21.003-21.004
C258.556,265.155,258.556,274.758,252.554,280.459z"/>
</svg>
</div>
<div class="rocket" style="height:500px;animation: animateShip 10s linear infinite;position:absolute;top:40%;">
<svg version="1.1" style="height:500px;" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 511.999 511.999" style="enable-background:new 0 0 511.999 511.999;" xml:space="preserve">
<path style="fill:#FFE470;" d="M206.047,392.377c-4.5,17.404-13.801,33.906-27.304,47.409
c-31.206,30.906-146.653,67.741-159.555,71.641c-5.102,1.5-10.802,0-14.702-3.901s-5.403-9.602-3.901-15.003
c3.901-12.601,41.034-127.751,71.938-158.955c13.502-13.502,30.005-22.804,47.409-27.306l42.907,42.909L206.047,392.377z"/>
<g>
<path style="fill:#FFD400;" d="M162.84,349.172l43.207,43.205c-4.5,17.404-13.801,33.906-27.304,47.409
c-31.206,30.906-146.653,67.741-159.555,71.641c-5.102,1.5-10.802,0-14.702-3.901L162.84,349.172z"/>
<path style="fill:#FFD400;" d="M167.942,365.373l-42.308,42.606c-3,2.701-6.9,4.201-10.501,4.201c-3.901,0-7.801-1.5-10.803-4.201
v-0.3c-5.701-6-5.701-15.303,0-21.003l42.608-42.308c5.701-6.001,15.003-6.001,20.704,0h0.3
C173.941,350.071,173.941,359.672,167.942,365.373z"/>
</g>
<path style="fill:#FDBF00;" d="M167.942,344.37c6,5.701,6,15.303,0,21.004l-42.308,42.606c-3,2.701-6.9,4.201-10.501,4.201
c-3.901,0-7.801-1.5-10.803-4.201v-0.3l63.312-63.311L167.942,344.37L167.942,344.37z"/>
<path style="fill:#FF7816;" d="M174.454,147.549c-106.552,0-140.178,90.082-142.876,93.092c-2.344,4.645-2.124,10.183,0.615,14.621
c2.725,4.439,7.56,7.149,12.775,7.149c61.578,5.445,100,8.842,96.93,8.57l51.03-123.434h-18.474V147.549z"/>
<path style="fill:#FF4B00;" d="M241.013,369.921c0.233,3.073,7.754,102.226,7.267,95.802c0,11.172,11.801,18.41,21.772,13.391
c3.004-2.692,93.092-36.96,93.092-142.876v-18.475L241.013,369.921z"/>
<path style="fill:#FF9F00;" d="M253.155,386.976c-15.902,8.102-31.805,15.904-46.808,23.405c-5.701,3-12.601,1.8-17.404-2.701
l-84.614-84.614c-4.5-4.8-5.701-11.701-2.699-17.402c7.501-15.003,15.303-30.906,23.403-46.808
c4.802-9.302,39.607,11.402,44.409,1.8l81.913,81.913C241.753,347.369,262.457,382.176,253.155,386.976z"/>
<path style="fill:#FF7816;" d="M253.155,386.976c-15.902,8.102-31.805,15.904-46.808,23.405c-5.701,3-12.601,1.8-17.404-2.701
l-42.306-42.306l63.911-63.611l40.807,40.807C241.753,347.369,262.457,382.176,253.155,386.976z"/>
<path style="fill:#ECECF1;" d="M499.497,149.037c-13.502,51.61-37.806,93.616-75.614,129.923
c-44.107,42.606-114.62,79.813-170.729,108.017l-63.911-63.911l-64.211-64.21c28.205-56.11,65.413-126.923,108.019-170.729
c36.305-37.806,78.313-62.111,129.923-75.614l30.303,11.102c0.601,26.104,11.102,49.809,28.205,66.91
c17.103,17.103,40.808,27.606,66.912,28.205L499.497,149.037z"/>
<path style="fill:#E2E2E7;" d="M499.497,149.037c-13.502,51.61-37.806,93.616-75.614,129.923
c-44.107,42.606-114.62,79.813-170.729,108.017l-63.911-63.911l232.239-232.54c17.103,17.103,40.808,27.606,66.912,28.205
L499.497,149.037z"/>
<path style="fill:#76E2F8;" d="M380.076,131.933c-29.104-29.104-76.813-29.104-105.917,0c-29.106,29.406-29.106,76.514,0,105.919
v0.3c29.104,29.104,76.813,29.104,105.917,0C409.482,208.746,409.482,161.34,380.076,131.933z"/>
<path style="fill:#FF9F00;" d="M499.497,149.037c-2.401,0-9.302-0.3-11.702-0.3c-34.507-0.599-65.11-14.401-87.614-36.905
c-22.504-22.504-36.307-53.11-36.907-87.614c0-2.401-0.298-9.302-0.298-11.702C405.582,1.413,453.289-1.288,497.098,0.512
c3.901,0,7.501,1.501,10.203,4.201c2.699,2.701,4.2,6.302,4.2,10.203C513.298,58.72,510.299,106.429,499.497,149.037z"/>
<path style="fill:#5A5A5A;" d="M252.554,280.459c-5.701,6.001-15.301,6.001-21.003,0c-6.001-5.701-6.001-15.303,0-21.004
c5.701-6,15.301-6,21.003,0C258.556,265.155,258.556,274.758,252.554,280.459z"/>
<path style="fill:#FF7816;" d="M499.497,149.037c-2.401,0-9.302-0.3-11.702-0.3c-34.507-0.599-65.11-14.401-87.614-36.905
L507.299,4.713c2.699,2.701,4.2,6.302,4.2,10.203C513.298,58.72,510.299,106.429,499.497,149.037z"/>
<path style="fill:#25D9F8;" d="M380.076,238.152c-29.104,29.104-76.813,29.104-105.917,0v-0.3l105.917-105.919
C409.482,161.34,409.482,208.746,380.076,238.152z"/>
<path style="fill:#444444;" d="M252.554,280.459c-5.701,6.001-15.301,6.001-21.003,0l21.003-21.004
C258.556,265.155,258.556,274.758,252.554,280.459z"/>
</svg>
</div>
</div>
</div>
</main>
</div>
</div>
<script>
$('[etap="edit_info"]').on('click', function(){
var _this = $(this)
_this.disabled=true;
var deft = _this.text()
var email = $("input[name='email']").val();
var nickname = $("input[name='nickname']").val();
var user_avatar_type = $("input[name='user_avatar_type']:checked").val();
var phone = $("input[name='phone']").val();
var qq = $("input[name='qq']").val();
var description = $("textarea[name='description']").val();
var captcha = $("input[name='edit_email_cap']").val();
_this.html(iconspin+deft)
$.post(caozhuti.ajaxurl,
{
nickname: nickname,
email: email,
phone: phone,
qq: qq,
description: description,
user_avatar_type: user_avatar_type,
captcha: captcha,
action: 'edit_user_info'
},
function (data) {
if (data == '1') {
_this.html(deft)
Swal.fire({
type: 'success',
title: '修改成功',
showConfirmButton: false,
timer: 1500
})
setTimeout(function(){location.reload()},1000),
location.href='<?php echo $_SERVER["HTTP_REFERER"]; ?>'
}else{
_this.html(deft)
swal.fire({
type: 'error',
title: data
})
}
_this.disabled=false;
}
);
});
</script>
<style>
.login .sinput{
outline:none;
background-color: transparent;
border: 0 solid #fff;
border-bottom: 1px solid #fff;
height:50px;
line-height: 50px;
}
.login .sinput:focus{
border-bottom: 1px solid #20aaff;
}
.svgdiv{
width: 100%;
/* float: left; */
position: absolute;
top: 0;
height: 100%;
}
.login {
width:30%;padding:0 20px;position: relative;left:35%;z-index: 99;
padding: 10px 20px;
background-color:rgba(255,255,255,0.1);
-webkit-box-shadow: #d4d2d2 0px 0px 10px;
-moz-box-shadow: #d4d2d2 0px 0px 10px;
border-radius:20px;
overflow:hidden;
}
body .star {
background-color: #4568a0;
width: 60px;
height: 10px;
border-radius: 20px 20px;
position: absolute;
}
body .star:nth-of-type(1) {
top: 5%;
animation: animateStar 10s linear infinite;
}
body .star:nth-of-type(2) {
top: 10%;
animation: animateStar 8s linear infinite;
}
body .star:nth-of-type(3) {
top: 20%;
animation: animateStar 6s linear infinite;
}
body .star:nth-of-type(4) {
top: 30%;
animation: animateStar 9s linear infinite;
}
body .star:nth-of-type(5) {
top: 50%;
animation: animateStar 7s linear infinite;
}
body .star:nth-of-type(6) {
top: 60%;
animation: animateStar 30s linear infinite;
}
body .star:nth-of-type(7) {
top: 70%;
animation: animateStar 18s linear infinite;
}
body .star:nth-of-type(8) {
top: 80%;
animation: animateStar 20s linear infinite;
}
body .star:nth-of-type(9) {
top: 90%;
animation: animateStar 25s linear infinite;
}
body .star:nth-of-type(10) {
top: 99%;
animation: animateStar 10s linear infinite;
}
body .rocket {
top: 35%;
position: relative;
overflow: hidden;
height: 200px;
animation: animateShip 20s linear infinite;
}
body .rocket svg {
animation: enlarge 2s infinite;
height: 200px;
overflow: visible;
max-height: 80%;
}
@keyframes enlarge {
0% {
transform: scale(0.4) rotate(45deg);
}
50% {
transform: scale(0.5) rotate(45deg);
}
100% {
transform: scale(0.4) rotate(45deg);
}
}
@keyframes animateShip {
0% {
margin-left: -300px;
}
55% {
margin-left: 55%;
}
60% {
margin-left: 40%;
}
100% {
margin-left: 100%;
}
}
@keyframes animateStar {
0% {
margin-left: 100%;
opacity: .3;
}
100% {
margin-left: -300px;
opacity: .1;
}
}
@media (max-width: 575px){
.login {
width:100%;left: 0px;
}
}
</style>
<?php get_footer();?>
3.将下方代码复制粘贴至主题functions.php文件底部,并使用第二步新建的页面网址替换掉下方代码$url = "https://5v13.com/info-edit"里面的网址
function jsemail(){ //补充邮箱资料
if ( is_user_logged_in() ) {
global $current_user;
$url = "https://5v13.com/info-edit";
if(substr($current_user->user_email,-7) == "@no.com" ){
echo "<SCRIPT LANGUAGE='javascript'>";
echo "if(this.location.href != '$url'){";
echo "location.href='$url'";
echo "}</SCRIPT>";
}
}
}
4.如需要全局开启(QQ登录后没有补充邮箱均会跳转至该页面)该功能,则复制
add_action( 'wp_head', 'jsemail' );
至functions.php文件底部;
如仅仅需要在进入用户中心时启用,则在打开主题pages/user.php,在get_header();(如无修改过主题则是第十行)后面插入一行,粘贴进jsemail()即可。
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)