zibll子比用户主页/用户中心/评论区添加UID及靓图标显示caonima4个月前更新关注私信33010举报内容 ------正文内容展示,开始汲取新知识啦------ 给子比用户主页/用户中心/评论区三个页面添加UID和靓号逻辑 单数字ID,AA~AAAAA ID、顺子ID增加靓号图标展示 原文链接:https://6ke.top/forum-post/788.html 演示 评论区 个人主页 用户中心 修改教程及代码 用户中心:/wp-content/themes/zibll/inc/functions/user/page.php 这段整个替换 function zib_user_page_header() { $user = wp_get_current_user(); $user_id = isset($user->ID) ? (int) $user->ID : 0; $info_class = 'flex header-info relative hh'; $cover = get_user_cover_img($user_id); $dropup_btn = ''; $avatar = zib_get_avatar_box($user_id, 'avatar-img', false, false); $avatar = '<div class="hover-show relative">'; $avatar .= zib_get_avatar_box($user_id, 'avatar-img', false, false); $avatar .= zib_get_user_avatar_set_link('absolute hover-show-con flex jc xx', '<i class="fa fa-camera mb6" aria-hidden="true"></i>修改头像') ?: ($user_id ? zib_get_user_home_link($user_id, 'absolute', '') : ''); $avatar .= '</div>'; $desc = ''; $btns = ''; if ($user_id) { $dropup_btn = '<div class="abs-center right-bottom box-body cover-btns">' . zib_get_user_page_header_dropup_btn($user_id) . '</div>'; $name = '<span class="display-name">' . zibpay_get_vip_icon(zib_get_user_vip_level($user_id), 'mr3') . $user->display_name . zib_get_user_auth_badge($user_id, 'ml3') . zib_get_user_level_badge($user_id, 'ml3') . '</span>'; if (_pz('checkin_s')) { $btns = zib_get_user_checkin_btn('but c-blue ml10 pw-1em radius', '<i class="fa fa-calendar-check-o"></i>签到', '<i class="fa fa-calendar-check-o"></i>已签到'); } else { } if (_pz('message_s')) { $btns .= zibmsg_nav_radius_button($user_id, 'ml10'); } $btns = '<div class="header-btns flex0 flex ac">' . $btns . '</div>'; // 判断用户 ID 是否为靓号 $is_lucky_id = false; $numStr = strval($user_id); //这里是判断靓号的正则表达式,如果没有覆盖你需要的规则靓号你可以自行添加规则 if (preg_match('/^([1-9])\1{0,}$|^([1-9]\d)\2{1,}$|^(?:123|234|345|456|567|678|789)\d{0,}$/', $numStr)) { $is_lucky_id = true; } // 如果是靓号,则在 UID 前面添加一个 SVG 图标 if ($is_lucky_id) { $desc = '<span class="but c-theme" data-toggle="tooltip" title="" data-clipboard-tag="UID" data-clipboard-text="' . $user_id . '" data-original-title="点击复制UID"><svg t="1724676985701" class="icon" viewBox="0 0 1109 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10521" style="width: 15px;height: 14px;"><path d="M42.666667 0m256 0l512 0q256 0 256 256l0 512q0 256-256 256l-512 0q-256 0-256-256l0-512q0-256 256-256Z" fill="#FF4200" p-id="10522"></path><path d="M219.050667 190.464h125.184v-51.456h69.888v51.456h119.04v59.136H414.122667v39.168h98.304v56.832H414.122667v39.936H546.986667v59.136H203.690667v-59.136h140.544V345.6H238.250667v-56.832h105.984v-39.168H219.050667v-59.136zM455.594667 844.8h-51.456l-17.664-64.512 48.384 3.84c9.216 0 14.592-7.68 14.592-23.04v-29.184H308.906667v114.432h-68.352V482.304h278.016v292.608c0 5.376-0.768 10.752-0.768 16.128 62.976-36.096 105.984-81.408 129.024-135.168 22.272-58.368 34.56-133.632 36.864-227.328V284.928h66.048v143.616c-1.536 62.976-7.68 118.272-16.896 166.656h48.384v151.296c0 16.896 5.376 25.344 16.128 25.344h27.648c6.912 0 12.15.2-10.752 11.52-26.88 17.664-48.384 17.664h-58.368c-41.472 0-61.44-24.576-61.44-73.728V657.408a507.733333 507.733333 0 0 1-17.664 45.312c-29.952 62.976-78.336 112.128-145.92 147.456l-36.096-56.832c-5.376 33.792-26.112 51.456-61.44 51.456zM308.906667 676.608h140.544v-40.704H308.906667v40.704z m0-96h140.544v-40.704H308.906667v40.704z m557.568-413.952v429.312h-69.12V232.704H636.842667v363.264h-67.584V166.656h297.216z" fill="#FFFFFF" p-id="10523"></path></svg>UID:' . $user_id . '</span>'; } else { $desc = '<span class="but c-theme" data-toggle="tooltip" title="" data-clipboard-tag="UID" data-clipboard-text="' . $user_id . '" data-original-title="点击复制UID">UID:' . $user_id . '</span>'; } $desc .= '<span class="but c-blue" data-toggle="tooltip" title="" data-clipboard-tag="用户名" data-clipboard-text="' . $user->user_login . '" data-original-title="点击复制用户名"><i class="fa fa-user-o"></i>' . $user->user_login . '</span>'; $desc .= $user->user_email ? '<span class="but c-yellow" data-toggle="tooltip" title="" data-clipboard-tag="邮箱" data-clipboard-text="' . $user->user_email . '" data-original-title="点击复制邮箱"><i class="fa fa-envelope-o"></i>' . $user->user_email . '</span>' : ''; $desc = apply_filters('user_page_header_desc', $desc, $user_id); $info_html_flex1 = '<div class="flex1">'; $info_html_flex1 .= '<div class="em12 name">' . $name . '</div>'; $info_html_flex1 .= '<div class="desc user-identity flex ac hh">' . $desc . '</div>'; $info_html_flex1 .= '</div>'; } else { $info_class .= ' signin-loader'; $info_html_flex1 = '<a href="javascript:;" class="display-name">Hi!请登录</a>'; } $info_html = '<div class="' . $info_class . '">'; $info_html .= '<div class="flex0 header-avatar">'; $info_html .= $avatar; $info_html .= '</div>'; $info_html .= $info_html_flex1; $info_html .= $btns; $info_html .= '</div>'; $html = '<div class="author-header mb20 radius8 main-shadow main-bg full-widget-sm">'; $html .= '<div class="page-cover">' . $cover . '<div class="absolute linear-mask"></div>' . $dropup_btn . '</div>'; $html .= '<div class="header-content">'; $html .= $info_html; $html .= '</div>'; $html .= '</div>'; echo $html; } 用户主页:/wp-content/themes/zibll/inc/functions/zib-author.php 这段整个替换 评论区:/wp-content/themes/zibll/inc/functions/zib-comments-list.php 这段整个替换 function zib_get_comments_user_name($comment) { if (!$comment) { return; } $user_id = $comment->user_id; $user_name = ''; if ($user_id) { $user = get_userdata($user_id); if (isset($user->display_name)) { $display_name = $user->display_name; $url = zib_get_user_home_url($user_id); // 判断用户 ID 是否为靓号 $is_lucky_id = false; $numStr = strval($user_id); if (preg_match('/^([1-9])\1{0,}$|^([1-9]\d)\2{1,}$|^(?:123|234|345|456|567|678|789)\d{0,}$/', $numStr)) { $is_lucky_id = true; } if ($is_lucky_id) { // 如果是靓号,则在 UID 前面添加一个 SVG 图标 $user_name = '<a class="text-ellipsis font-bold" href="' . $url . '">' . $display_name . '<span class="badg badg-sm c-blue moderator-bagd ml3 flex0"><svg t="1724676985701" class="icon" viewBox="0 0 1109 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10521" style="width: 15px;height: 14px;"><path d="M42.666667 0m256 0l512 0q256 0 256 256l0 512q0 256-256 256l-512 0q-256 0-256-256l0-512q0-256 256-256Z" fill="#FF4200" p-id="10522"></path><path d="M219.050667 190.464h125.184v-51.456h69.888v51.456h119.04v59.136H414.122667v39.168h98.304v56.832H414.122667v39.936H546.986667v59.136H203.690667v-59.136h140.544V345.6H238.250667v-56.832h105.984v-39.168H219.050667v-59.136zM455.594667 844.8h-51.456l-17.664-64.512 48.384 3.84c9.216 0 14.592-7.68 14.592-23.04v-29.184H308.906667v114.432h-68.352V482.304h278.h48.384v151.296c0 16.896 5.376 25.344 16.128 25.344h27.648c6.912 0 12.288-3.84 15.36-11.52 3.84-8.448 6.912-34.56 8.448-79.104l59.904 19.968c-4.608 64.512-13.056 102.912-23.808 115.2-10.752 11.52-26.88 17.664-48.384 17.664h-58.368c-41.472 0-61.44-24.576-61.44-73.728V657.408a507.733333 507.733333 0 0 1-17.664 45.312c-29.952 62.976-78.336 112.128-145.92 147.456l-36.096-56.832c-5.376 33.792-26.112 51.456-61.44 51.456zM308.906667 676.608h140.544v-40.704H308.906667v40.704z m0-96h140.544v-40.704H308.906667v40.704z m557.568-413.952v429.312h-69.12V232.704H636.842667v363.264h-67.584V166.656h297.216z" fill="#FFFFFF" p-id="10523"></path></svg> UID:' . $user_id . '</span></a>'; } else { $user_name = '<a class="text-ellipsis font-bold" href="' . $url . '">' . $display_name . '<span class="badg badg-sm c-blue moderator-bagd ml3 flex0"><i class="fa fa-id-card-o"></i> UID:' . $user_id . '</span></a>'; } $user_name .= zib_get_user_auth_badge($user_id, 'ml3'); $user_name .= zib_get_medal_wear_icon($user_id, 'ml3'); $user_name .= zib_get_user_level_badge($user_id, 'ml3'); } } $user_name = $user_name ? $user_name : '<b class="mr6">' . $comment->comment_author . '</b>'; $badge = '' if ($user_id && _pz('comment_author_tag', true)) { $post = get_post($comment->comment_post_ID); if ($user_id == $post->post_author) { $badge .= '<span class="badg c-green badg-sm flex0 ml3">作者</span>'; } } $badge = apply_filters('comments_user_name_badge', $badge, $comment); return '<name class="flex ac flex1">' . $topping_badge . $user_name . $badge . '</name>'; } 温馨提示:本文最后更新于2024-09-25 16:54:52,某些文章具有时效性,若有错误或已失效,请私信客服或联系知新社长。------本文内容已结束,喜欢请分享------ 感谢您的访问,Ctrl+D收藏本站吧。 zibll子比用户主页/用户中心/评论区添加UID及靓图标显示此内容为付费阅读,请付费后查看星元2立即购买您当前未登录!订单有效期仅保留7天。供学习和研究使用,请在下载后24小时内删除 购买前可以联系作者确认资源信息,防止交易矛盾 会员特权技术支持自动发货网络收集付费阅读已售 6© 版权声明 相关声明 1、本站名称:知新网 2、本站永久网址:https://www.uzhix.com 3、本站部分内容源于网络和用户投稿,仅供学习与参考,如有侵权,请联系站长进行删除处理。 4、用户评论和发布内容,并不代表本站赞同其观点和对其真实性负责。 5、本站禁止以任何方式发布或转载任何违法的相关信息。 6、资源大多存储在云盘,如发现链接失效,请联系我们替换更新。 九月 25 知岛上的今时往日 2023:子比主题首页实现区块文章排行榜展示小工具 (1)2023:自制微信游戏咸鱼之王辅助过关自动刷题小工具 (0) THE END子比主题博客/论坛/社区# 复制# 替换# 主页# 评论区# 点击 点赞0投币 分享QQ空间微博QQ好友海报分享复制链接收藏1