WordPress$用户ID始终返回1
Im使用此代码在为管理员和订阅者备份的wp中显示每个用户配置文件的用户注册日期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
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>