示例#1
0
function xt_ajax_follow()
{
    $result = array('code' => 0, 'msg' => '', 'result' => array());
    $user = wp_get_current_user();
    if ($user->exists()) {
        if (isset($_POST['user_id']) && isset($_POST['f_user_id'])) {
            if ($user->ID == $_POST['f_user_id']) {
                global $wpdb;
                $follow_count = $wpdb->get_var($wpdb->prepare("SELECT count(*) FROM " . XT_TABLE_USER_FOLLOW . " WHERE f_user_id=%d", $user->ID));
                if ($follow_count >= xt_followlimit()) {
                    $result['code'] = 500;
                    $result['msg'] = '您已达到关注限额(' . xt_followlimit() . ')';
                } else {
                    $result['result'] = xt_follow_by_id($_POST['user_id'], $_POST['f_user_id']);
                }
            } else {
                $result['code'] = 500;
                $result['msg'] = '您无权限操作此用户';
            }
        } else {
            $result['code'] = 500;
            $result['msg'] = '未指定要关注的对象';
        }
    } else {
        $result['code'] = 500;
        $result['msg'] = '未登录';
    }
    exit(json_encode($result));
}
示例#2
0
                        <input name="albumDisplay" type="radio" value="small" <?php 
echo xt_albumdisplay() == 'small' ? 'checked' : '';
?>
>9小图
                    </label>
                </fieldset>
            </td>
        </tr>
        <tr valign="top">
            <th scope="row">会员</th>
            <td>
                <fieldset>
                    <label for="followLimit">
                        最多关注<input name="followLimit"
                                   type="number" step="1" min="500" max="5000" id="followLimit" value="<?php 
echo xt_followlimit();
?>
"
                                   class="small-text">个会员
                    </label>
                </fieldset>
            </td>
        </tr>
        <tr valign="top">
            <th scope="row">第三方统计代码</th>
            <td>
                <?php 
$codeAnalytics = xt_code_analytics();
?>
                <label for="codeAnalytics">如:
                    <a href="http://tongji.baidu.com/" target="_blank">百度统计</a>,