Follow 粉丝关注
[原创]

Follow 粉丝关注

分类:功能增强
版本:1.00.14
下载:26
获星:0
创建时间:2020-12-27
最后更新:2022-12-12
请到后台应用商店下载 / Please go to the background app store to download

一款关注好友及好友动态的插件,支持修改粉丝数和显示粉丝页数,预留钩子,可自由扩展。/ A plug-in that pays attention to fans and friends' dynamics, supports modifying the number of fans and displaying the number of fan pages, reserved hooks, and can be expanded freely.

 

1.关注和取消关注;

2.关注用户后,进入个人中心页面展示的动态为自己和所关注用户的最新主题或被回复的主题(这里比较有用);

3.后台可修改粉丝数量,具体不解释干什么用的;

4.后台可设置粉丝展示页数,不解释干什么用的;

5.进入某用户个人中心可看到粉丝数量,可关注,如已关注则显示取关按钮;

6.在主题详情页可以关注和取关;

7.被关注的用户会收到关注通知(装有通知插件的情况下)

8.支持评论关注;

9.支持查看某用户个人中心的粉丝和关注,可直接关注和取关;

 

2021.01.18

重写了全部代码,目的是增加评论关注和用户的个人中心关注,模板和钩子有修改,自行替换;

 

自制模板自行添加,可对照默认模板钩子

comment_list_inc_username_after.htm

<!-- 除了btn btn-primary btn-sm mx-1 px-1 py-0可以修改替换,其他勿动 -->
<a class="follow ajax btn btn-outline-success btn-sm mx-1 px-1 py-0" <?php if (!$uid){ echo 'data-modal-title="'.lang('login').'"';}?> uid="<?php echo $_post['uid'];?>" rel="nofollow" data-method="post" href="javascript:void(0);">
    <?php echo lang('well_follow');?>
</a>

 

common_brief.htm

<div class="d-block">
    <a class="btn btn-outline-success btn-sm px-1 py-0" rel="nofollow" href="<?php echo url('my-follow',array('type'=>1));?>">
        <!-- 关注 -->
        <?php echo lang('well_follow');?>
    </a>
    <span class="mx-1 small">
        <!-- 关注数量 -->
        <?php echo $user['well_follows'];?>
    </span>
    <a class="btn btn-outline-success btn-sm px-1 py-0" rel="nofollow" href="<?php echo url('my-follow');?>">
        <!-- 粉丝 -->
        <?php echo lang('well_follow_fans');?>
    </a>
    <span class="mx-1 small">
        <!-- 粉丝数量 -->
        <?php echo $user['well_false_fans'] > $user['well_fans'] ? $user['well_false_fans'] : $user['well_fans'];?>
    </span>
</div>

 

user_common_count_register_before.htm

<span class="mx-1">
    <a data-active="user-follow" class="btn btn-outline-secondary btn-sm px-1 py-0" rel="nofollow" href="<?php echo url('user-follow', array('uid'=>$_uid, 'type'=>1));?>">
        <!-- 关注 -->
        <?php echo lang('well_follow');?>
    </a>
    <span class="mx-1 small">
        <!-- 关注数量 -->
        <?php echo $_user['well_follows'];?>
    </span>
    <a data-active="user-follow-fans" class="btn btn-outline-secondary btn-sm px-1 py-0" rel="nofollow" href="<?php echo url('user-follow', array('uid'=>$_uid, 'type'=>0));?>">
        <!-- 粉丝 -->
        <?php echo lang('well_follow_fans');?>
    </a>
    <span class="mx-1 small">
        <!-- 粉丝数量 -->
        <?php echo $_user['well_false_fans']?$_user['well_false_fans']:$_user['well_fans'];?>
    </span>
</span>

 

user_common_username_after.htm

<small class="mx-1">
    <!-- 除了btn btn-primary btn-sm px-1 py-0可以修改替换,其他勿动 -->
    <a class="follow ajax btn btn-outline-success btn-sm px-1 py-0" uid="<?php echo $_uid;?>" rel="nofollow" data-method="post" href="javascript:void(0);">
        <?php echo lang('well_follow');?>
    </a>
</small>

 

user_home_js_after.htm

<script>
    var followlist = document.getElementsByClassName('follow');
    var length = followlist.length;
    var followuids = [];
    for (var i = 0; i < length; ++i) {
        var _uid = followlist[i].getAttribute('uid');
        if (undefined != _uid) {
            followuids[i] = _uid;
        }
    }

    if (followuids.length) {
        $.xpost(xn.url('user-follow'), {'uidarr': followuids}, function (code, data) {
            if (code == 0) {
                var _length = followlist.length;
                var length = data.length;
                for (var i = 0; i < length; ++i) {
                    for (var j = 0; j < _length; ++j) {
                        var _uid = followlist[j].getAttribute('uid');
                        if (undefined != _uid && _uid == data[i].uid) {
                            followlist[j].setAttribute('href', data[i].url);
                            followlist[j].setAttribute('data-method', data[i].method);
                            followlist[j].innerHTML = data[i].text;
                        }
                    }
                }
            }
        });
    }
</script>

 

read_date_before.htm

<!-- 除了btn btn-primary btn-sm mx-1 px-1 py-0可以修改替换,其他勿动 -->
<a class="follow ajax btn btn-outline-success btn-sm mx-1 px-1 py-0" <?php if (!$uid){ echo 'data-modal-title="'.lang('login').'"';}?> uid="<?php echo $thread['uid'];?>" rel="nofollow" data-method="post" href="javascript:void(0);">
    <?php echo lang('well_follow');?>
</a>

 

read_js.htm

<script>
    var followlist = document.getElementsByClassName('follow');
    var length = followlist.length;
    var followuids = [];
    for (var i = 0; i < length; ++i) {
        var _uid = followlist[i].getAttribute('uid');
        if ('undefined' != _uid && _uid) {
            followuids[i] = _uid;
        }
    }

    if (followuids.length) {
        $.xpost(xn.url('user-follow'), {'uidarr': followuids}, function (code, data) {
            if (code == 0) {
                var _length = followlist.length;
                var length = data.length;
                for (var i = 0; i < length; ++i) {
                    for (var j = 0; j < _length; ++j) {
                        var _uid = followlist[j].getAttribute('uid');
                        if ('undefined' != _uid && _uid == data[i].uid) {
                            if (data[i].tips) {
                                /*followlist[j].setAttribute('data-modal-title', data[i].tips);*/
                                followlist[j].classList.remove('ajax');
                                followlist[j].removeAttribute('data-method');
                            } else {
                                followlist[j].setAttribute('data-method', data[i].method);
                                /*var _class = followlist[j].getAttribute('class');
                                followlist[j].setAttribute('class', 'ajax '+_class);*/
                            }
                            followlist[j].setAttribute('href', data[i].url);
                            followlist[j].innerHTML = data[i].text;
                        }
                    }
                }
            }
        });
    }
</script>

 

2 个自制模板

my_follow.htm

user_follow.htm

0
最新回复(0)