WordPress建站教程:后台用户列表显示注册时间

前端之家收集整理的这篇文章主要介绍了WordPress建站教程:后台用户列表显示注册时间前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

wordpress网站如果开启了用户注册功能,随着网站用户数量的不断增多,管理起来也越来越麻烦,并且wordpress后台用户列表在默认的情况下是不显示注册时间的,这样对于用户的管理就更加困难了,今天我们介绍一个让后台用户列表显示注册时间的方法,希望可以帮助到那些需要显示用户注册时间的站长们。

切换到主题目录,打开 functions.PHP 文件,加入以下代码

Crayon-5c891d2923d2d875662459" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-mixed-highlight" title="Contains Mixed Languages">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-language">PHP
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-1">1
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-2">2
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-3">3
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-4">4
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-5">5
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-6">6
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-7">7
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-8">8
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-9">9
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-10">10
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-11">11
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-12">12
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-13">13
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-14">14
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-15">15
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-16">16
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-17">17
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-18">18
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-19">19
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-20">20
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-21">21
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-22">22
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-23">23
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-24">24
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-25">25
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-26">26
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-27">27
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-28">28
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-29">29
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-30">30
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-31">31
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-32">32
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-33">33
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-34">34
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-35">35
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-36">36
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-37">37
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-38">38
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-39">39
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-40">40
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-41">41
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-42">42
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-43">43
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-44">44
Crayon-num" data-line="Crayon-5c891d2923d2d875662459-45">45
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2923d2d875662459-46">46
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891d2923d2d875662459-1">Crayon-ta">PHP
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-2">Crayon-c">/**
Crayon-line" id="Crayon-5c891d2923d2d875662459-3">Crayon-c"> * wordpress 后台用户列表显示注册时间
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-4">Crayon-c"> */
Crayon-line" id="Crayon-5c891d2923d2d875662459-5">Crayon-t">classCrayon-h"> Crayon-e">RRHECrayon-h"> Crayon-sy">{
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-6">Crayon-h"> Crayon-c">// Register the column - Registered
Crayon-line" id="Crayon-5c891d2923d2d875662459-7">Crayon-h"> Crayon-m">publicCrayon-h"> Crayon-m">staticCrayon-h"> Crayon-t">functionCrayon-h"> Crayon-e">registerdateCrayon-sy">(Crayon-v">$columnsCrayon-sy">)Crayon-h"> Crayon-sy">{
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-8">Crayon-h"> Crayon-v">$columnsCrayon-sy">[Crayon-s">'registerdate'Crayon-sy">]Crayon-h"> Crayon-o">=Crayon-h"> Crayon-e">__Crayon-sy">(Crayon-s">'注册时间'Crayon-sy">,Crayon-h"> Crayon-s">'registerdate'Crayon-sy">)Crayon-sy">;
Crayon-line" id="Crayon-5c891d2923d2d875662459-9">Crayon-h"> Crayon-k ">returnCrayon-h"> Crayon-v">$columnsCrayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-10">Crayon-h"> Crayon-sy">}
Crayon-line" id="Crayon-5c891d2923d2d875662459-11">Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-12">Crayon-h"> Crayon-c">// Display the column content
Crayon-line" id="Crayon-5c891d2923d2d875662459-13">Crayon-h"> Crayon-m">publicCrayon-h"> Crayon-m">staticCrayon-h"> Crayon-t">functionCrayon-h"> Crayon-e">registerdate_columnsCrayon-sy">(Crayon-h"> Crayon-v">$valueCrayon-sy">,Crayon-h"> Crayon-v">$column_nameCrayon-sy">,Crayon-h"> Crayon-v">$user_idCrayon-h"> Crayon-sy">)Crayon-h"> Crayon-sy">{
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-14">Crayon-h"> Crayon-st">ifCrayon-h"> Crayon-sy">(Crayon-h"> Crayon-s">'registerdate'Crayon-h"> Crayon-o">!=Crayon-h"> Crayon-v">$column_nameCrayon-h"> Crayon-sy">)
Crayon-line" id="Crayon-5c891d2923d2d875662459-15">Crayon-h"> Crayon-k ">returnCrayon-h"> Crayon-v">$valueCrayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-16">Crayon-h"> Crayon-v">$userCrayon-h"> Crayon-o">=Crayon-h"> Crayon-e">get_userdataCrayon-sy">(Crayon-h"> Crayon-v">$user_idCrayon-h"> Crayon-sy">)Crayon-sy">;
Crayon-line" id="Crayon-5c891d2923d2d875662459-17">Crayon-h"> Crayon-v">$registerdateCrayon-h"> Crayon-o">=Crayon-h"> Crayon-e">get_date_from_gmtCrayon-sy">(Crayon-v">$userCrayon-i">user_registeredCrayon-sy">)Crayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-18">Crayon-h"> Crayon-k ">returnCrayon-h"> Crayon-v">$registerdateCrayon-sy">;
Crayon-line" id="Crayon-5c891d2923d2d875662459-19">Crayon-h"> Crayon-sy">}
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-20">Crayon-h">
Crayon-line" id="Crayon-5c891d2923d2d875662459-21">Crayon-h"> Crayon-m">publicCrayon-h"> Crayon-m">staticCrayon-h"> Crayon-t">functionCrayon-h"> Crayon-e">registerdate_column_sortableCrayon-sy">(Crayon-v">$columnsCrayon-sy">)Crayon-h"> Crayon-sy">{
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-22">Crayon-h"> Crayon-v">$customCrayon-h"> Crayon-o">=Crayon-h"> Crayon-t">arrayCrayon-sy">(
Crayon-line" id="Crayon-5c891d2923d2d875662459-23">Crayon-h"> sortby value used in query
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-24">Crayon-h"> Crayon-s">'registerdate'Crayon-h">Crayon-o">=Crayon-h"> Crayon-s">'registered'Crayon-sy">,
Crayon-line" id="Crayon-5c891d2923d2d875662459-25">Crayon-h"> Crayon-sy">)Crayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-26">Crayon-h"> Crayon-k ">returnCrayon-h"> Crayon-e">wp_parse_argsCrayon-sy">(Crayon-v">$customCrayon-sy">,Crayon-h"> Crayon-v">$columnsCrayon-sy">)Crayon-sy">;
Crayon-line" id="Crayon-5c891d2923d2d875662459-27">Crayon-h"> Crayon-sy">}
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-28">Crayon-h">
Crayon-line" id="Crayon-5c891d2923d2d875662459-29">Crayon-h"> Crayon-m">publicCrayon-h"> Crayon-m">staticCrayon-h"> Crayon-t">functionCrayon-h"> Crayon-e">registerdate_column_orderbyCrayon-sy">(Crayon-h"> Crayon-v">$varsCrayon-h"> Crayon-sy">)Crayon-h"> Crayon-sy">{
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-30">Crayon-h"> Crayon-st">ifCrayon-h"> Crayon-sy">(Crayon-h"> Crayon-k ">issetCrayon-sy">(Crayon-h"> Crayon-v">$varsCrayon-sy">[Crayon-s">'orderby'Crayon-sy">]Crayon-h"> Crayon-sy">)Crayon-h"> Crayon-o">&&Crayon-h"> Crayon-s">'registerdate'Crayon-h"> Crayon-o">==Crayon-h"> Crayon-v">$varsCrayon-sy">[Crayon-s">'orderby'Crayon-sy">]Crayon-h"> Crayon-sy">)Crayon-h"> Crayon-sy">{
Crayon-line" id="Crayon-5c891d2923d2d875662459-31">Crayon-h"> Crayon-v">$varsCrayon-h"> Crayon-o">=Crayon-h"> Crayon-e">array_mergeCrayon-sy">(Crayon-h"> Crayon-v">$varsCrayon-sy">,Crayon-h"> Crayon-t">arrayCrayon-sy">(
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-32">Crayon-h"> Crayon-s">'Meta_key'Crayon-h"> Crayon-o">=Crayon-h"> Crayon-s">'registerdate'Crayon-sy">,
Crayon-line" id="Crayon-5c891d2923d2d875662459-33">Crayon-h"> Crayon-s">'orderby'Crayon-h"> Crayon-o">=Crayon-h"> Crayon-s">'Meta_value'
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-34">Crayon-h"> Crayon-sy">)Crayon-h"> Crayon-sy">)Crayon-sy">;
Crayon-line" id="Crayon-5c891d2923d2d875662459-35">Crayon-h"> Crayon-sy">}
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-36">Crayon-h"> Crayon-k ">returnCrayon-h"> Crayon-v">$varsCrayon-sy">;
Crayon-line" id="Crayon-5c891d2923d2d875662459-37">Crayon-h"> Crayon-sy">}
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-38">Crayon-h">
Crayon-line" id="Crayon-5c891d2923d2d875662459-39">Crayon-sy">}
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-40">Crayon-h">
Crayon-line" id="Crayon-5c891d2923d2d875662459-41">Crayon-c">// Actions
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-42">Crayon-e">add_filterCrayon-sy">(Crayon-h"> Crayon-s">'manage_users_columns'Crayon-sy">,Crayon-h"> Crayon-t">arrayCrayon-sy">(Crayon-s">'RRHE'Crayon-sy">,Crayon-s">'registerdate'Crayon-sy">)Crayon-sy">)Crayon-sy">;
Crayon-line" id="Crayon-5c891d2923d2d875662459-43">Crayon-e">add_actionCrayon-sy">(Crayon-h"> Crayon-s">'manage_users_custom_column'Crayon-sy">,Crayon-h">Crayon-t">arrayCrayon-sy">(Crayon-s">'RRHE'Crayon-sy">,Crayon-s">'registerdate_columns'Crayon-sy">)Crayon-sy">,Crayon-h"> Crayon-cn">15Crayon-sy">,Crayon-h"> Crayon-cn">3Crayon-sy">)Crayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-44">Crayon-e">add_filterCrayon-sy">(Crayon-h"> Crayon-s">'manage_users_sortable_columns'Crayon-sy">,Crayon-s">'registerdate_column_sortable'Crayon-sy">)Crayon-h"> Crayon-sy">)Crayon-sy">;
Crayon-line" id="Crayon-5c891d2923d2d875662459-45">Crayon-e">add_filterCrayon-sy">(Crayon-h"> Crayon-s">'request'Crayon-sy">,Crayon-s">'registerdate_column_orderby'Crayon-sy">)Crayon-h"> Crayon-sy">)Crayon-sy">;
Crayon-line Crayon-striped-line" id="Crayon-5c891d2923d2d875662459-46">

具体的使用情况,站长朋友们可以加入上面的代码进行测试。

猜你在找的wordpress相关文章