AhmedHamouda
Member
Posted 7 months ago #
I wanna make a folder for every new person register to wordpress.. This folder will be used to save some of his info imported from another application!
I know how to make a folder with php but where should I add the code
mkdir("/path/to/my/dir", 0700); [PHP: mkdir]
The name of the folder will be the id or the username of the user..
Hook into user_register()
http://codex.wordpress.org/Plugin_API/Action_Reference/user_register
add_action( 'user_register', 'ngtj_create_directory' );
function ngtj_create_directory( $user_login )
{
// get user data by login
$user = get_user_by( 'login', $user_login );
// create directory here
mkdir( '/path/to/my/dir/'.$user->ID );
}