zblog php仅要1元的前台用户中心(百搭)插件YtUser

搬瓦工机场JMS

YtUser插件是目前为止zblog仅有几款会员中心插件中唯一的一款1元的zblog会员中心插件,通过YtUser插件可以轻松实现zblog php网站前台用户中心功能,其中包括前台注册登陆、QQ一键免注册登陆、修改资料、投稿、文章收藏、积分充值、VIP充值、文章付费内容、文章购买等,且支持支付宝即时到帐接口,但是需开启“支付宝即时到帐接口”插件以及申请支付宝接口。

安装教程:

1、下载插件YtUser.zip(在网站后台应用中心搜索“YtUser”直接安装)

2、解压压缩包,把解压出来的YtUser文件夹通过FTP上传至网站的zb_users/plugin/目录

3、登陆网站后台,在插件管理中启用“用户中心”插件

4、插件启用后,可以在后台——右上角——用户中心——插件说明中查看各页面对应的URL链接,当然这些页面需要进行适配后才能打开

适配教程

注意:以下的代码都是这些页面的核心代码,还需要自行根据自己的需要进行代码设计编写。

登陆模板

在主题template/目录下创建文件t_login.php,并在文件中添加以下代码:

1
2
3
4
5
6
登录{$user.Name}<input type="text" id="edtUserName" name="edtUserName" placeholder="Username"><input type="password" id="edtPassWord" name="edtPassWord" placeholder="Password"><input type="checkbox" id="chkRemember" name="chkRemember" >Remember me<button type="submit" id="loginbtnPost" name="loginbtnPost" onclick="return Ytuser_Login()">Login</button>使用快捷登录:<a href="{$host}zb_users/plugin/YtUser/login.php" class="">QQ登录</a>
登陆模板

在主题template/目录下创建文件t_register.php,并在文件中添加以下代码:

1
2
3
4
5
6
(*)名称:<input required="required" type="text" name="name">(*)密码:<input required="required" type="password" name="password">(*)确认密码:<input required="required" type="password" name="repassword">(*)验证码<input required="required" type="text" name="verifycode" >{$article.verifycode}<input type="submit" value="提交" onclick="return register()">一键注册:<a href="{$host}zb_users/plugin/YtUser/login.php" class="">QQ注册</a>
用户中心

在主题template/目录下创建文件t_user.php,并在文件中添加以下代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<input id="edtID" name="ID" type="hidden" value="{$user.ID}" /><input id="edtGuid" name="Guid" type="hidden" value="{$user.Guid}" />(*)账户:{$user.Name}{if (substr($user.Name,0,3) == 'yt_')}<a href="'.$zbp->host.'?Nameedit">修改账户名(仅一次机会)</a>{/if}用户级别:{if $user.Level < 4}VIP会员{else}普通会员{/if}<a href="{$host}?Upgrade">{if $user.Level < 4}续费{else}购买{/if}会员</a>到期时间:{$user.Vipendtime}用户积分:{$user.Price}<a href="{$zbp->host}?Integral">购买积分</a>用户名:<input required="required" type="text" id="edtAlias" name="Alias" value="{$user.StaticName}" />电话:<input required="required" type="text" id="meta_Tel" name="meta_Tel" value="{$user.Metas.Tel}" />会员地址:<input required="required" type="text" id="meta_Add" name="meta_Add" value="{$user.Metas.Add}" />邮箱:<input type="text" id="edtEmail" name="Email" value="{$user.Email}" />网站:<input type="text" id="edtHomePage" name="HomePage" value="{$user.HomePage}" />摘要:<textarea id="edtIntro" name="Intro" >{$user.Intro}</textarea>验证码:<input required="required" type="text" name="verifycode" />{$article.verifycode}<button onclick="return checkInfo();">确定</button>{$article.js}

提示:其中电话和地址可以根据情况是否添加。到期时间这块,可根据情况设置普通会员是否显示。

此外如需额外添加新的字段,请认准格式:

1
<input required="required" type="text" id="meta_新字段id" name="meta_新字段id" value="{$user.Metas.新字段id}" />

并添加以下JS

1
"meta_新字段id":$("input[name='meta_新字段id]").val(),

额外添加新的字段的时候请注意先删除上面的

1
{$article.js}

然后添加一下代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<script type="text/javascript">functiON checkInfo(){$.post(bloghost+'zb_users/plugin/YtUser/cmd.php?act=MemberPst&token={$zbp->GetToken()}',
	{
	"ID":$("input[name='ID']").val(),
	"Guid":$("input[name='Guid']").val(),
	"Alias":$("input[name='Alias']").val(),
	"meta_Tel":$("input[name='meta_Tel']").val(),
	"meta_Add":$("input[name='meta_Add']").val(),
	"Email":$("input[name='Email']").val(),
	"HomePage":$("input[name='HomePage']").val(),
	"Intro":$("textarea[name='Intro']").val(),
	"verifycode":$("input[name='verifycode']").val(),
	},
	function(data){
		var s =data;
		if((s.search("faultCode")>0)&&(s.search("faultString")>0))
		{
		alert(s.match("<string>.+?</string>")[0].replace("<string>","").replace("</string>",""));
		$("#reg_verfiycode").attr("src",bloghost+"zb_system/script/c_validcode.php?id=User&amp;tm="+Math.random());
		}
		else{
			var s =data;
			alert(s);
			window.location=bloghost+'?User';
		}
	});}</script>
积分充值

在主题template/目录下创建文件t_integral.php,并在文件中添加以下代码:

1
2
3
4
5
用户积分:{$user.Price}充值介绍:{$zbp.Config('YtUser').integral_text}(*)充值卡:<input required="required" type="text" name="invitecode"  />(*)验证码:<input required="required" type="text" name="verifycode"  />{$article.verifycode}<input type="submit" value="提交" onclick="return Integral()">
VIP月充值

在主题template/目录下创建文件t_upgrade.php,并在文件中添加以下代码:

1
2
3
4
5
6
7
8
用户级别:{$lang['user_level_name'][$user.Level]}{if $user.Level < 5}到期时间:{$user.Vipendtime}{/if}页面介绍:{$zbp.Config('YtUser').readme_text}(*)充值卡:<input required="required" type="text" name="invitecode" />(*)验证码:<input required="required" type="text" name="verifycode"  />{$article.verifycode}<input type="submit" value="提交" onclick="return RegPage()" />

提示:$user.Level < 5控制的是当会员级别不够的时候,不显示到期时间信息。

发表投稿

在主题template/目录下创建文件t_articleedt.php,并在文件中添加以下代码:

1
2
3
4
5
<input type="hidden" name="token" id="token" value="{$zbp->GetToken()}" />标题:<input id="edtTitle" class="edit" name="Title" type="text">内容:{$article.UEditor}验证码:<input required="required" name="verifycode" type="text"> {$article.verifycode}<button onclick="return checkArticleInfo();">确定</button>

提示:默认编辑器用的是UEditor的简化版。所以,插件目录里面需要有UEditor插件。

需要注意的是,本页面默认情况下,仅对协作者({$user.Level}小于5)的用户开放投稿功能。所以,最好在本页面设置下判断,当用户权限不足时,提示需要购买用户等级。参考代码:

1
2
3
4
5
{if $user.Level<5}核心代码{else}权限不足提示代码。{/if}
投稿列表

在主题template/目录下创建文件t_articlelist.php,并在文件中添加以下代码:

1
2
3
{foreach $articles as $article}{$article.Time()}、{$article.Url}、{$article.Title}、{$article.Intro}、{$article.Author.StaticName}、{$article.Category.Name}、{$article.ViewNums}、{$article.CommNums}{/foreach}
购买列表

在主题template/目录下创建文件t_paylist.php,并在文件中添加以下代码:

1
2
3
4
5
6
7
{foreach $articles as $article}订单号:{$article.OrderID}</td>标题:<a href="{$article.Url}">{$article.Title}</a>下单时间:{$article.PostTime}付款状态{if $article.State}已支付{else}<a href="{$host}?buy&uid={$article.LogID}">未支付</a>{/if}{/foreach}{template:pagebar}
支付状态

在主题template/目录下创建文件t_buy.php,并在文件中添加以下代码:

1
2
3
4
5
6
7
8
9
10
11
<input type="hidden" name="LogID" id="LogID" value="{$article.BuyID}" /><input type="hidden" name="LogUrl" id="LogUrl" value="{$article.BuyTUrl}" />产品:{$article.BuyTitle}价格:{$article.BuyPrice}账户余额:{$user.Price}{if $article.buynum}已购买{else}(*)验证码:<input required="required" type="text" name="verifycode"  />{$article.verifycode}<input type="submit" value="付款" onclick="return Ytbuypay()"/>{/if}

提示:购买状态需用用{$article.buynum}进行判断。

评论列表

在主题template/目录下创建文件t_commentlist.php,并在文件中添加以下代码:

1
2
3
4
5
6
7
{foreach $articles as $article}留言的文章:{$article.Title}留言的链接:{$article.Url}留言内容:{$article.Intro}留言发布时间:{$article.Time('Y年m月d日 h:i:s')}分页:{template:pagebar}{/foreach}
密码找回

在主题template/目录下创建文件t_resetpwd.php,并在文件中添加以下代码:

1
2
3
4
(*)用户名:<input required="required" type="text" name="name" />(*)邮箱:<input type="text" name="email" />验证码:<input required="required" type="text" name="verifycode"/>{$article.verifycode}<input type="submit" value="提交" onclick="return resetpwd()" />

提示:需开启“邮件发送”插件,没有添加邮箱账户的,不能使用密码找回功能。

密码重置

在主题template/目录下创建文件t_resetpassword.php,并在文件中添加以下代码:

1
2
3
4
5
6
7
<input type="hidden" name="username" id="inpId" value="{$article.username}" /><input type="hidden" name="hash" id="inpId" value="{$article.hash}" />(*)名称:{$article.username}(*)重置密码:<input required="required" type="password" name="password"  />(*)确认密码:<input required="required" type="password" name="repassword"  />(*)验证码<input required="required" type="text" name="verifycode" />{$article.verifycode}<input type="submit" value="提交" onclick="return Resetpassword()" />

提示:本页面仅能通过邮箱提供的链接进来,切一小时内会失效。

修改密码

在主题template/目录下创建文件t_changepassword.php,并在文件中添加以下代码:

1
2
3
4
5
6
7
8
9
<input type="hidden" name="token" id="token" value="{$zbp->GetToken()}" />(*)账户:{$user.Name}{if $user.Password != '0e681aa506fc191c5f2fa9be6abddd01'}(*)原密码:<input required="required" type="password" name="password" />{/if}(*)重置密码:<input required="required" type="password" name="newpassword" />(*)确认密码:input required="required" type="password" name="repassword" />(*)验证码<input required="required" type="text" name="verifycode" />{$article.verifycode}<input type="submit" value="提交" onclick="return Changepassword()" />

提示:第三方登录的用户第一次修改密码的时候不需要输入原密码;第三方登录的初始密码为二次加密,这个页面获取到的仅仅是第一道加密,所以不会造成用户密码泄露。

修改用户名

在主题template/目录下创建文件t_nameedit.php,并在文件中添加以下代码:

1
2
3
4
5
6
<input type="hidden" name="token" id="token" value="{$zbp->GetToken()}" />(*)原账户:{$user.Name}(*)修改账户:<input required="required" type="text" name="name"  />(*)确认账户:<input required="required" type="text" name="rename"/>(*)验证码<input required="required" type="text" name="verifycode"  />{$article.verifycode}<input type="submit" value="提交" onclick="return Nameedit()" />

提示:本页面仅针对第三方登录的账户开放,且仅能修改一次账户名。

绑定QQ

在主题template/目录下创建文件t_binding.php,并在文件中添加以下代码:

1
2
3
4
5
{if $article.BindingQQ}此账户已绑定过QQ{else}<a href="{$host}zb_users/plugin/YtUser/login.php" target="_blank">绑定QQ</a>{/if}

提示:本页面仅针对第三方登录的账户开放,且仅能修改一次账户名。

未经允许不得转载:搬瓦工VPS_美国VPS » zblog php仅要1元的前台用户中心(百搭)插件YtUser

赞 (0) 打赏

相关推荐

    暂无内容!

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏