database - adding user_id and name to a separate table whenever a user register based on role

add_action( 'register_new_user', newfun);function newfun( $user_id ){$user = new WP_User( $user_id );if ( ! e

add_action( 'register_new_user', newfun);
function newfun( $user_id ){
    $user = new WP_User( $user_id );

if ( ! empty( $user->roles ) && is_array( $user->roles ) && in_array( 'latepoint_agent', $user->roles ) ) {
    global $wpdb;




    $status = $wpdb->query('INSERT INTO `wp_latepoint_agents` (`wp_user_id`) VALUES ('.$user_id.')');   
}

}

The Problem is this doesnot work. Any suggestion?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742419705a4440435.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信