Answer the question
In order to leave comments, you need to log in
Creating a folder when registering via Theme my login?
I’ve already found everything, I can’t achieve a result on the Theme my login plugin, it works on others, but I want it on this one!
Bottom line: after registering a user, a folder with a user ID should be created.
Tell me where to add the line
mkdir("./$user_id", 0700);
to Theme my login plugin
Answer the question
In order to leave comments, you need to log in
no need to insert anything into any plugin.
It is enough to hang on the 'user_register' hook
function wpp_create_dir_for_user( $user_id ) {
$upload_dir = wp_upload_dir();
$user_dir = sprintf( '%s/users/%s', $upload_dir[ 'basedir' ], $user_id );
wp_mkdir_p( $user_dir );
}
add_action( 'user_register', 'wpp_create_dir_for_user' );
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question