i must create a “consumer folder” in media library for consumer registration utilizing usermeta subject, for instance “billing_company”.. so, my objective is to procect file url inside that folder from unlogged customers and logged customers with totally different usermeta subject/e mail..
somebody please will help me with snippet?
thanks you
perform 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->billing_company;
wp_mkdir_p($user_dir); }
add_action( 'user_register', 'create_user_dir');