最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - New user - Create a folder

programmeradmin3浏览0评论

You wrote:

You can use the user_register action to hook into the register proces and then create the user directory with wp_mkdir_p.

function create_user_dir($user_id) {
    $user_info = get_userdata( $user_id );

    $upload_dir = wp_upload_dir();
    $user_dir = $upload_dir['basedir'] . '/user_dirs/' . $user_info->user_login;

    wp_mkdir_p($user_dir);
}
add_action( 'user_register', 'create_user_dir');

Since I am an absolute beginner with PHP and Wordpress, please WHERE SHOULD I ENTER THE CODE YOU WROTE, EXACTLY ? Which PHP file and which row ? I ask you these questions because I tried to enter the code in wp_insert_user(), in ../wp-includes/user.php, with no result. No folder was created. Please could you help me by indicating the row where I should enter the function. Thank you so much !

Marco

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论