Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WordPress$用户ID始终返回1_Wordpress_Date_Account - Fatal编程技术网

WordPress$用户ID始终返回1

WordPress$用户ID始终返回1,wordpress,date,account,Wordpress,Date,Account,Im使用此代码在为管理员和订阅者备份的wp中显示每个用户配置文件的用户注册日期 add_action( 'show_user_profile', 'display_user_custom' ); add_action( 'edit_user_profile', 'display_user_custom' ); function display_user_custom( $user ) { ?> <h3>Registration</h3> <t

Im使用此代码在为管理员和订阅者备份的wp中显示每个用户配置文件的用户注册日期

add_action( 'show_user_profile', 'display_user_custom' );
add_action( 'edit_user_profile', 'display_user_custom' );

function display_user_custom( $user ) { ?>
    <h3>Registration</h3>
    <table class="form-table">
        <tr>
            <th><label>Registered Since</label></th>
            <td><?php $udata = get_userdata( $user-ID );
$registered = $udata->user_registered; echo date( "d M Y", strtotime( $registered ) ); ?></td>
        </tr>
    </table>
    <?php
}
add_操作('show_user_profile'、'display_user_custom');
添加操作(“编辑用户配置文件”、“显示用户自定义”);
函数显示\用户\自定义($user){?>
登记处
注册自
固定为:

<td><?php $udata = get_usermeta($user->ID, 'user_registered'); echo date( "d M Y", strtotime( $udata ) ); ?></td>