使用RuleUser接管Typecho用户中心教程 - 星泽V社

星泽
2022-05-13 / 0 评论 / 243 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2022年05月15日,已超过48天没有更新,若内容或图片失效,请留言反馈。

RuleUser通过API的方式完全接管typecho的用户系统,让Typecho网站拥有一个独立会员中心的同时,还可以将前台用户的操作全部API化。
具体演示请查看 Typecho独立用户中心上线-星泽V社
RuleUser安装及介绍请查看 Typecho独立会员中心,前后端分离,充值付费功能集成,APP扫码登录
本文讲解会员系统接管typecho的教程(不接管也没事,看自己心情就好),这里我只写我网站Joe主题的修改,仅供参考,其他主题去看看不暇的教程 会员系统接管教程

2022.5.15更新接管版文件,可以直接替换主题文件完成接管
Joe主题RuleUser接管版文件-星泽V社

l35hlmo3.png
l35hlza6.png

方案有两种,第一种是php实现,第二种是js实现

  • 方案一的好处是不会对模板进行大改,可以很方面的接管,而且完全按照php的标签规范,但是坏处是如果挂了cdn就会导致登录状态被缓存,就比如我自己网站的首页。而且性能的提升不如纯js前后端分离。
  • 方案二的好处是完全js前后端分离,无论是用户交互还是网站性能都可以依靠js达到很高的提升,缺点就是需要有js的基础知识,对个人能力有要求,并且如果碰到复杂的模板,改起来也废时间。

我使用的是方案二 js前后端分离
,需要在typecho模板中引入RuleUser,只需要修改模板的footer.php文件,在</body>的上方,加入如下代码(ruleuser是我前面步骤自定义的文件夹名称,代表RuleUser所在目录):

<script src="/ruleuser/configs.js?v1.02"></script>
<script src="/ruleuser/main/RuleUser.js?v1.02"></script>
<script>
    loadPostBtn(<?php echo $this->cid; ?>);
    loadPostShop(<?php echo $this->cid; ?>)
</script>

然后,在文章模板,post.php合适的位置(一般是文章内容底下,加入如下代码):

<div id="RuleUser-PostShop"></div>
<div id="RuleUser-PostBtn"></div>

l37cu1ja.png

这样,就可以调用出文章插入的付费商品和操作按钮,截图如下:
l33xl8h5.png

会员的登录注册

1.在 themes/Joe/public/footer.php 文件最后添加以下代码
(注意修改ruleuser的文件目录)

<script src="/user/configs.js?v1.02"></script>
<script src="/user/main/RuleUser.js?v1.02"></script>
<script>
    loadPostBtn(<?php echo $this->cid; ?>);
    loadPostShop(<?php echo $this->cid; ?>)
    userInfo()
    function userInfo(){
        if(localStorage.getItem('userinfo')){
            var userInfo = JSON.parse(localStorage.getItem('userinfo'));
            var uid = userInfo.uid;
            var name = userInfo.name;
            var lv = Number(userInfo.lv);
            var lvText = rankList[lv];
            var lvStyle = rankStyle[lv];
            if(userInfo.screenName){
                name = userInfo.screenName;
            }
            var customize = "";
            if(userInfo.customize){
                customize = `<span>${userInfo.customize}</span>`;
            }
            var html =`
            <div class="joe_dropdown" trigger="click">
                <div class="joe_dropdown__link">
                    <svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="15" height="15">
                        <path d="M231.594 610.125C135.087 687.619 71.378 804.28 64.59 935.994c-.373 7.25 3.89 23.307 30.113 23.307s33.512-16.06 33.948-23.301c6.861-114.025 63.513-214.622 148.5-280.346 3.626-2.804 16.543-17.618 3.24-39.449-13.702-22.483-40.863-12.453-48.798-6.08zm280.112-98.44v63.96c204.109 0 370.994 159.345 383.06 360.421.432 7.219 8.649 23.347 32.44 23.347s31.991-16.117 31.62-23.342c-12.14-236.422-207.676-424.386-447.12-424.386z" />
                        <path d="M319.824 319.804c0-105.974 85.909-191.883 191.882-191.883s191.883 85.91 191.883 191.883c0 26.57-5.405 51.88-15.171 74.887-5.526 14.809-2.082 31.921 20.398 38.345 23.876 6.822 36.732-8.472 41.44-20.583 11.167-28.729 17.294-59.973 17.294-92.65 0-141.297-114.545-255.842-255.843-255.842S255.863 178.506 255.863 319.804s114.545 255.843 255.843 255.843v-63.961c-105.973-.001-191.882-85.909-191.882-191.882z" />
                        <path d="M512 255.843s21.49-5.723 21.49-31.306S512 191.882 512 191.882c-70.65 0-127.921 57.273-127.921 127.922 0 3.322.126 6.615.375 9.875.264 3.454 14.94 18.116 37.044 14.425 22.025-3.679 26.6-21.93 26.6-21.93-.028-.788-.06-1.575-.06-2.37.001-35.325 28.637-63.961 63.962-63.961z" />
                    </svg>
                    <span>${name}</span>
                </div>
                <nav class="joe_dropdown__menu">
                <a rel="noopener noreferrer nofollow" target="_blank" href="/user/">会员中心</a>
                <a rel="noopener noreferrer nofollow" target="_blank" href="/user/">管理文章</a>
                <a href="javascript:;" onclick="UserQuit()">退出登录</a>
                </nav>
            </div>
            `;
            
             $("#userLogin-main").html(html);
             var wapHtml=`
             <a class="link panel" href="#" rel="nofollow">
                <span>${name}</span>
                <svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="15" height="15">
                    <path d="M231.594 610.125C135.087 687.619 71.378 804.28 64.59 935.994c-.373 7.25 3.89 23.307 30.113 23.307s33.512-16.06 33.948-23.301c6.861-114.025 63.513-214.622 148.5-280.346 3.626-2.804 16.543-17.618 3.24-39.449-13.702-22.483-40.863-12.453-48.798-6.08zm280.112-98.44v63.96c204.109 0 370.994 159.345 383.06 360.421.432 7.219 8.649 23.347 32.44 23.347s31.991-16.117 31.62-23.342c-12.14-236.422-207.676-424.386-447.12-424.386z" />
                    <path d="M319.824 319.804c0-105.974 85.909-191.883 191.882-191.883s191.883 85.91 191.883 191.883c0 26.57-5.405 51.88-15.171 74.887-5.526 14.809-2.082 31.921 20.398 38.345 23.876 6.822 36.732-8.472 41.44-20.583 11.167-28.729 17.294-59.973 17.294-92.65 0-141.297-114.545-255.842-255.843-255.842S255.863 178.506 255.863 319.804s114.545 255.843 255.843 255.843v-63.961c-105.973-.001-191.882-85.909-191.882-191.882z" />
                    <path d="M512 255.843s21.49-5.723 21.49-31.306S512 191.882 512 191.882c-70.65 0-127.921 57.273-127.921 127.922 0 3.322.126 6.615.375 9.875.264 3.454 14.94 18.116 37.044 14.425 22.025-3.679 26.6-21.93 26.6-21.93-.028-.788-.06-1.575-.06-2.37.001-35.325 28.637-63.961 63.962-63.961z" />
                </svg>
            </a>
            <ul class="slides panel-body">
                <li>
                        <a class="link" rel="noopener noreferrer nofollow" target="_blank"  href="/user/">会员中心</a>
                </li>
                <li>
                        <a class="link" rel="noopener noreferrer nofollow" target="_blank" href="/user/">管理文章</a>
                </li>
                <li>
                    <a class="link" rel="noopener noreferrer nofollow" onclick="UserQuit()">退出登录</a>
                </li>
            </ul>
            `;
            $("#wap-login-main").html(wapHtml);
            $('.joe_dropdown').each(function (index, item) {
                const menu = $(this).find('.joe_dropdown__menu');
                const trigger = $(item).attr('trigger') || 'click';
                const placement = $(item).attr('placement') || $(this).height() || 0;
                menu.css('top', placement);
                if (trigger === 'hover') {
                    $(this).hover(
                        () => $(this).addClass('active'),
                        () => $(this).removeClass('active')
                    );
                } else {
                    $("body").on('click',this,function(e){
                    //$(this).on('click', function (e) {
                        $(this).toggleClass('active');
                        $(document).one('click', () => $(this).removeClass('active'));
                        e.stopPropagation();
                    });
                    menu.on('click', e => e.stopPropagation());
                }
            });
    
            var newCommentHeader = `
            <div class="list">
                <input type="text" value="${name}" autocomplete="off" name="author" maxlength="16" placeholder="请输入昵称..." />
            </div>
            <div class="list">
                <input type="text" value="${userInfo.mail}" autocomplete="off" name="mail" placeholder="请输入邮箱..." />
            </div>
            <div class="list">
                <input type="text" value="${userInfo.url}" autocomplete="off" name="url" placeholder="请输入网址(非必填)..." />
            </div>
            `;
            $("#newCommentHeader").html(newCommentHeader);
            
        }else{
            
            var html=`
            <div class="item">
                <svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="15" height="15">
                    <path d="M710.698 299a213.572 213.572 0 1 0-213.572 213.954A213.572 213.572 0 0 0 710.698 299zm85.429 0a299.382 299.382 0 1 1-299-299 299 299 0 0 1 299 299z" />
                    <path d="M114.223 1024a46.91 46.91 0 0 1-46.91-46.91 465.281 465.281 0 0 1 468.332-460.704 475.197 475.197 0 0 1 228.827 58.35 46.91 46.91 0 1 1-45.384 82.378 381.378 381.378 0 0 0-183.443-46.909 371.08 371.08 0 0 0-374.131 366.886A47.29 47.29 0 0 1 114.223 1024zM944.483 755.129a38.138 38.138 0 0 0-58.733 0l-146.449 152.55-92.675-91.53a38.138 38.138 0 0 0-58.732 0 43.858 43.858 0 0 0 0 61.402l117.083 122.422a14.492 14.492 0 0 0 8.39 4.577c4.196 0 4.196 4.195 8.39 4.195h32.037c4.195 0 4.195-4.195 8.39-4.195s4.195-4.577 8.39-4.577L946.39 816.15a48.054 48.054 0 0 0-1.906-61.02z" />
                    <path d="M763.328 776.104L730.53 744.45a79.708 79.708 0 0 0 32.798 31.654" />
                </svg>
                <a href="javascript:;"  onclick="UserLogin()" rel="noopener noreferrer nofollow">登录</a>
                <span class="split">/</span>
                <a href="javascript:;" onclick="UserRegister()" rel="noopener noreferrer nofollow">注册</a>
            </div>
            `;
            $("#userLogin-main").html(html);
            var wapHtml=`
             <a class="link panel" href="#" rel="nofollow">
                <span>用户登录</span>
                <svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="15" height="15">
                    <path d="M231.594 610.125C135.087 687.619 71.378 804.28 64.59 935.994c-.373 7.25 3.89 23.307 30.113 23.307s33.512-16.06 33.948-23.301c6.861-114.025 63.513-214.622 148.5-280.346 3.626-2.804 16.543-17.618 3.24-39.449-13.702-22.483-40.863-12.453-48.798-6.08zm280.112-98.44v63.96c204.109 0 370.994 159.345 383.06 360.421.432 7.219 8.649 23.347 32.44 23.347s31.991-16.117 31.62-23.342c-12.14-236.422-207.676-424.386-447.12-424.386z" />
                    <path d="M319.824 319.804c0-105.974 85.909-191.883 191.882-191.883s191.883 85.91 191.883 191.883c0 26.57-5.405 51.88-15.171 74.887-5.526 14.809-2.082 31.921 20.398 38.345 23.876 6.822 36.732-8.472 41.44-20.583 11.167-28.729 17.294-59.973 17.294-92.65 0-141.297-114.545-255.842-255.843-255.842S255.863 178.506 255.863 319.804s114.545 255.843 255.843 255.843v-63.961c-105.973-.001-191.882-85.909-191.882-191.882z" />
                    <path d="M512 255.843s21.49-5.723 21.49-31.306S512 191.882 512 191.882c-70.65 0-127.921 57.273-127.921 127.922 0 3.322.126 6.615.375 9.875.264 3.454 14.94 18.116 37.044 14.425 22.025-3.679 26.6-21.93 26.6-21.93-.028-.788-.06-1.575-.06-2.37.001-35.325 28.637-63.961 63.962-63.961z" />
                </svg>
            </a>
            <ul class="slides panel-body">
                <li>
                    <a class="link" href="javascript:;"  onclick="UserLogin()" rel="noopener noreferrer nofollow">登录</a>
                    <a class="link" href="javascript:;" onclick="UserRegister()" rel="noopener noreferrer nofollow">注册</a>
                </li>
            </ul>
            `;
            $("#wap-login-main").html(wapHtml);
            
            var newCommentHeader = `
            <div class="list">
                <input type="text" value="" autocomplete="off" name="author" maxlength="16" placeholder="请输入昵称..." />
            </div>
            <div class="list">
                <input type="text" value="" autocomplete="off" name="mail" placeholder="请输入邮箱..." />
            </div>
            <div class="list">
                <input type="text" value="" autocomplete="off" name="url" placeholder="请输入网址(非必填)..." />
            </div>
            `;
            $("#newCommentHeader").html(newCommentHeader);
        }
    }
</script>

2.修改/usr/themes/joezhinian/Joe-master/public/ 下的 header.php 文件
第23行代码

                <?php if (strpos($_SERVER['HTTP_HOST'], 'zhinianblog.com') !== false) : ?>

修改为

                <?php if ($_SERVER['HTTP_HOST'] == 'zhinianblog.com' or $_SERVER['HTTP_HOST'] == 'www.zhinianblog.com') : ?>

第228行代码

 <div class="joe_header__below-sign">
                <?php if ($this->user->hasLogin()) : ?>
                    <div class="joe_dropdown" trigger="click">
                        <div class="joe_dropdown__link">
                            <svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="15" height="15">
                                <path d="M231.594 610.125C135.087 687.619 71.378 804.28 64.59 935.994c-.373 7.25 3.89 23.307 30.113 23.307s33.512-16.06 33.948-23.301c6.861-114.025 63.513-214.622 148.5-280.346 3.626-2.804 16.543-17.618 3.24-39.449-13.702-22.483-40.863-12.453-48.798-6.08zm280.112-98.44v63.96c204.109 0 370.994 159.345 383.06 360.421.432 7.219 8.649 23.347 32.44 23.347s31.991-16.117 31.62-23.342c-12.14-236.422-207.676-424.386-447.12-424.386z" />
                                <path d="M319.824 319.804c0-105.974 85.909-191.883 191.882-191.883s191.883 85.91 191.883 191.883c0 26.57-5.405 51.88-15.171 74.887-5.526 14.809-2.082 31.921 20.398 38.345 23.876 6.822 36.732-8.472 41.44-20.583 11.167-28.729 17.294-59.973 17.294-92.65 0-141.297-114.545-255.842-255.843-255.842S255.863 178.506 255.863 319.804s114.545 255.843 255.843 255.843v-63.961c-105.973-.001-191.882-85.909-191.882-191.882z" />
                                <path d="M512 255.843s21.49-5.723 21.49-31.306S512 191.882 512 191.882c-70.65 0-127.921 57.273-127.921 127.922 0 3.322.126 6.615.375 9.875.264 3.454 14.94 18.116 37.044 14.425 22.025-3.679 26.6-21.93 26.6-21.93-.028-.788-.06-1.575-.06-2.37.001-35.325 28.637-63.961 63.962-63.961z" />
                            </svg>
                            <span><?php $this->user->screenName(); ?></span>
                        </div>
                        <nav class="joe_dropdown__menu">
                            <?php if ($this->user->group == 'administrator' || $this->user->group == 'editor' || $this->user->group == 'contributor') : ?>
                                <a rel="noopener noreferrer nofollow" target="_blank" href="<?php $this->options->adminUrl("manage-posts.php"); ?>">管理文章</a>
                            <?php endif; ?>
                            <?php if ($this->user->group == 'administrator' || $this->user->group == 'editor') : ?>
                                <a rel="noopener noreferrer nofollow" target="_blank" href="<?php $this->options->adminUrl("manage-comments.php"); ?>">管理评论</a>
                            <?php endif; ?>
                            <?php if ($this->user->group == 'administrator') : ?>
                                <a rel="noopener noreferrer nofollow" target="_blank" href="<?php $this->options->adminUrl("options-theme.php"); ?>">修改外观</a>
                            <?php endif; ?>
                            <a rel="noopener noreferrer nofollow" target="_blank" href="<?php $this->options->adminUrl(); ?>">进入后台</a>
                            <a href="<?php $this->options->logoutUrl(); ?>">退出登录</a>
                        </nav>
                    </div>
                <?php else : ?>
                    <div class="item">
                        <svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="15" height="15">
                            <path d="M710.698 299a213.572 213.572 0 1 0-213.572 213.954A213.572 213.572 0 0 0 710.698 299zm85.429 0a299.382 299.382 0 1 1-299-299 299 299 0 0 1 299 299z" />
                            <path d="M114.223 1024a46.91 46.91 0 0 1-46.91-46.91 465.281 465.281 0 0 1 468.332-460.704 475.197 475.197 0 0 1 228.827 58.35 46.91 46.91 0 1 1-45.384 82.378 381.378 381.378 0 0 0-183.443-46.909 371.08 371.08 0 0 0-374.131 366.886A47.29 47.29 0 0 1 114.223 1024zM944.483 755.129a38.138 38.138 0 0 0-58.733 0l-146.449 152.55-92.675-91.53a38.138 38.138 0 0 0-58.732 0 43.858 43.858 0 0 0 0 61.402l117.083 122.422a14.492 14.492 0 0 0 8.39 4.577c4.196 0 4.196 4.195 8.39 4.195h32.037c4.195 0 4.195-4.195 8.39-4.195s4.195-4.577 8.39-4.577L946.39 816.15a48.054 48.054 0 0 0-1.906-61.02z" />
                            <path d="M763.328 776.104L730.53 744.45a79.708 79.708 0 0 0 32.798 31.654" />
                        </svg>
                        <a href="<?php $this->options->adminUrl('login.php'); ?>" target="_blank" rel="noopener noreferrer nofollow">登录</a>
                        <?php if ($this->options->allowRegister) : ?>
                            <span class="split">/</span>
                            <a href="<?php $this->options->adminUrl('register.php'); ?>" target="_blank" rel="noopener noreferrer nofollow">注册</a>
                        <?php endif; ?>
                    </div>
                <?php endif; ?>

修改为

            <div class="joe_header__below-sign" id="userLogin-main">
           

第308行代码

            <img width="50" height="50" class="avatar lazyload" src="<?php _getAvatarLazyload(); ?>" data-src="<?php $this->options->JAside_Author_Avatar ? $this->options->JAside_Author_Avatar() : _getAvatarByMail($this->authorId ? $this->author->mail : $this->user->mail) ?>" alt="博主昵称" />

修改为

            <img width="50" height="50" class="avatar lazyload" src="<?php _getAvatarLazyload(); ?>" data-src="<?php $this->options->JAside_Author_Avatar ? $this->options->JAside_Author_Avatar() : _getAvatarByMail($this->author->mail) ?>" alt="博主昵称" />

311行代码

                <a class="link" href="<?php $this->options->JAside_Author_Link() ?>" target="_blank" rel="noopener noreferrer nofollow"><?php $this->options->JAside_Author_Nick ? $this->options->JAside_Author_Nick() : ($this->authorId ? $this->author->screenName() : $this->user->screenName()); ?></a>

修改为

                <a class="link" href="<?php $this->options->JAside_Author_Link() ?>" target="_blank" rel="noopener noreferrer nofollow"><?php $this->options->JAside_Author_Nick ? $this->options->JAside_Author_Nick() : $this->author->screenName(); ?></a>

如果报错就把恋爱计时这个模块删掉,也就是删除以下315行以下代码:

       <!-- 恋爱计时 -->
        <?php if ($this->options->LoveTime) :  ?>
            <?php 
                $LoveTime = [];
                $LoveTime_text = $this->options->LoveTime;
                if ($LoveTime_text) {
                    $leftQq = trim(explode("||", $LoveTime_text)[0]);
                    $RightQq = trim(explode("||", $LoveTime_text)[1]);
                    $loveDate = trim(explode("||", $LoveTime_text)[2]);
                }
            ?>
            <ul class="joe_header__slideout-count">
                <div id="lovexhj" style="width: 100%; height: 100%; text-align: center; font-size: 1rem;">
                    <div id="lovexhjImage" style="width: 220px; margin: 0 auto;">
                        <!-- 左边的头像 -->
                        <img src="https://q1.qlogo.cn/g?b=qq&nk=<?php echo $leftQq; ?>&s=640" alt="love" style="width: 60px; border-radius: 50%;">
                        <!-- 中间的图片 -->
                        <img src="https://atbk.oss-cn-shanghai.aliyuncs.com/image/aotian/love.gif" alt="love" style="width: 60px; border-radius: 50%;">
                        <!-- 右边的头像 -->
                        <img src="https://q1.qlogo.cn/g?b=qq&nk=<?php echo $RightQq; ?>&s=640" alt="love" style="width: 60px; border-radius: 50%;">
                    </div>
                    <p id="loveSitetime4Header" style="font-size: 1.0rem;"></p>
                </div>
            </ul>
            <script language=javascript>
                loveSitetime('<?php echo $loveDate; ?>');
            </script>
        <?php endif; ?>

最后418行代码

        <ul class="joe_header__slideout-menu panel-box" style="margin-top: 15px; <?php if(Helper::options()->login4Phone !== 'on') echo 'display:none;'  ?>">
            <li>
                <?php if ($this->user->hasLogin()) : ?>
                    <a class="link panel" href="#" rel="nofollow">
                        <span><?php $this->user->screenName(); ?></span>
                        <svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="15" height="15">
                            <path d="M231.594 610.125C135.087 687.619 71.378 804.28 64.59 935.994c-.373 7.25 3.89 23.307 30.113 23.307s33.512-16.06 33.948-23.301c6.861-114.025 63.513-214.622 148.5-280.346 3.626-2.804 16.543-17.618 3.24-39.449-13.702-22.483-40.863-12.453-48.798-6.08zm280.112-98.44v63.96c204.109 0 370.994 159.345 383.06 360.421.432 7.219 8.649 23.347 32.44 23.347s31.991-16.117 31.62-23.342c-12.14-236.422-207.676-424.386-447.12-424.386z" />
                            <path d="M319.824 319.804c0-105.974 85.909-191.883 191.882-191.883s191.883 85.91 191.883 191.883c0 26.57-5.405 51.88-15.171 74.887-5.526 14.809-2.082 31.921 20.398 38.345 23.876 6.822 36.732-8.472 41.44-20.583 11.167-28.729 17.294-59.973 17.294-92.65 0-141.297-114.545-255.842-255.843-255.842S255.863 178.506 255.863 319.804s114.545 255.843 255.843 255.843v-63.961c-105.973-.001-191.882-85.909-191.882-191.882z" />
                            <path d="M512 255.843s21.49-5.723 21.49-31.306S512 191.882 512 191.882c-70.65 0-127.921 57.273-127.921 127.922 0 3.322.126 6.615.375 9.875.264 3.454 14.94 18.116 37.044 14.425 22.025-3.679 26.6-21.93 26.6-21.93-.028-.788-.06-1.575-.06-2.37.001-35.325 28.637-63.961 63.962-63.961z" />
                        </svg>
                    </a>
                    <ul class="slides panel-body">
                        <li>
                            <?php if ($this->user->group == 'administrator' || $this->user->group == 'editor' || $this->user->group == 'contributor') : ?>
                                <a class="link" rel="noopener noreferrer nofollow" target="_blank" href="<?php $this->options->adminUrl("manage-posts.php"); ?>">管理文章</a>
                            <?php endif; ?>
                        </li>
                        <li>
                            <?php if ($this->user->group == 'administrator' || $this->user->group == 'editor') : ?>
                                <a class="link" rel="noopener noreferrer nofollow" target="_blank" href="<?php $this->options->adminUrl("manage-comments.php"); ?>">管理评论</a>
                            <?php endif; ?>
                        </li>
                        <li>
                            <?php if ($this->user->group == 'administrator') : ?>
                                <a class="link" rel="noopener noreferrer nofollow" target="_blank" href="<?php $this->options->adminUrl("options-theme.php"); ?>">修改外观</a>
                            <?php endif; ?>
                        </li>
                        <li>
                            <a class="link" rel="noopener noreferrer nofollow" target="_blank" href="<?php $this->options->adminUrl(); ?>">进入后台</a>
                        </li>
                        <li>
                            <a class="link" rel="noopener noreferrer nofollow" href="<?php $this->options->logoutUrl(); ?>">退出登录</a>
                        </li>
                    </ul>
                <?php else : ?>
                    <a class="link panel" href="#" rel="nofollow">
                        <span>用户登录</span>
                        <svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="15" height="15">
                            <path d="M231.594 610.125C135.087 687.619 71.378 804.28 64.59 935.994c-.373 7.25 3.89 23.307 30.113 23.307s33.512-16.06 33.948-23.301c6.861-114.025 63.513-214.622 148.5-280.346 3.626-2.804 16.543-17.618 3.24-39.449-13.702-22.483-40.863-12.453-48.798-6.08zm280.112-98.44v63.96c204.109 0 370.994 159.345 383.06 360.421.432 7.219 8.649 23.347 32.44 23.347s31.991-16.117 31.62-23.342c-12.14-236.422-207.676-424.386-447.12-424.386z" />
                            <path d="M319.824 319.804c0-105.974 85.909-191.883 191.882-191.883s191.883 85.91 191.883 191.883c0 26.57-5.405 51.88-15.171 74.887-5.526 14.809-2.082 31.921 20.398 38.345 23.876 6.822 36.732-8.472 41.44-20.583 11.167-28.729 17.294-59.973 17.294-92.65 0-141.297-114.545-255.842-255.843-255.842S255.863 178.506 255.863 319.804s114.545 255.843 255.843 255.843v-63.961c-105.973-.001-191.882-85.909-191.882-191.882z" />
                            <path d="M512 255.843s21.49-5.723 21.49-31.306S512 191.882 512 191.882c-70.65 0-127.921 57.273-127.921 127.922 0 3.322.126 6.615.375 9.875.264 3.454 14.94 18.116 37.044 14.425 22.025-3.679 26.6-21.93 26.6-21.93-.028-.788-.06-1.575-.06-2.37.001-35.325 28.637-63.961 63.962-63.961z" />
                        </svg>
                    </a>
                    <ul class="slides panel-body">
                        <li>
                            <a class="link" href="<?php $this->options->adminUrl('login.php'); ?>" target="_blank" rel="noopener noreferrer nofollow">登录</a>
                            <?php if ($this->options->allowRegister) : ?>
                                <a class="link" href="<?php $this->options->adminUrl('register.php'); ?>" target="_blank" rel="noopener noreferrer nofollow">注册</a>
                            <?php endif; ?>
                        </li>
                    </ul>
                <?php endif; ?>

修改为

        <ul class="joe_header__slideout-menu panel-box" style="margin-top: 15px; <?php if(Helper::options()->login4Phone !== 'on') echo 'display:none;'  ?>" >
            <li id="wap-login-main">

3.修改themes/Joe/publiccomment.php 文件
第4行代码

    $CommentCoid = @$_POST["coid"];
    $db->query($db->update('table.comments')->rows(array('status' => @$_POST["type"]))->where('coid = ?', $CommentCoid));

修改为

    $CommentCoid = $_POST["coid"];
    $db->query($db->update('table.comments')->rows(array('status' => $_POST["type"]))->where('coid = ?', $CommentCoid));

第25行代码

 <form method="post" class="joe_comment__respond-form" action="<?php $this->commentUrl() ?>" data-type="text">
                    <div class="head">
                        <div class="list">
                            <input type="text" value="<?php $this->user->hasLogin() ? $this->user->screenName() : $this->remember('author') ?>" autocomplete="off" name="author" maxlength="16" placeholder="请输入昵称..." />
                        </div>
                        <div class="list">
                            <input type="text" value="<?php $this->user->hasLogin() ? $this->user->mail() : $this->remember('mail') ?>" autocomplete="off" name="mail" placeholder="请输入邮箱..." />
                        </div>
                        <div class="list">
                            <input type="text" value="<?php $this->user->hasLogin() ? $this->user->url() : $this->remember('url') ?>" autocomplete="off" name="url" placeholder="请输入网址(非必填)..." />
                        </div>

修改为

                <form method="post" class="joe_comment__respond-form" action="<?php $this->commentUrl() ?>" data-type="text" id="newComment">
                    <div class="head" id="newCommentHeader">
                        

第47行代码

                                <textarea class="text joe_owo__target" name="text" value="" autocomplete="new-password" placeholder="说点什么吧,点击右上方切换成画图或者点击上传图片试试?"></textarea>

修改为

                                <textarea class="text joe_owo__target" name="text" value="" id="RuleText" autocomplete="new-password" placeholder="说点什么吧,点击右上方切换成画图或者点击上传图片试试?"></textarea>

第51行代码

                                 <textarea class="text joe_owo__target" name="text" value="" autocomplete="new-password" placeholder="说点什么吧,点击右上方切换成画图或者点击上传图片试试?"></textarea>

修改为

                                <textarea class="text joe_owo__target" name="text" value="" id="RuleText"  autocomplete="new-password" placeholder="说点什么吧,点击右上方切换成画图或者点击上传图片试试?"></textarea>

第80行代码

                            <button type="submit">发送评论</button>

修改为

                            <button type="button" onclick="addComments(<?php echo $this->cid; ?>,'#newComment')">发送评论</button>

可能应该大概就是这样了....我不太确定...备份一下再测试哈家人们!!!!!

本文来源于星泽V社,未经允许禁止转载,原文链接: https://www.52xzv.cn/archives/693.html

本文共 917 个字数,平均阅读时长 ≈ 3分钟

评论 (0)

取消