WordPress.org

Ready to get started?Download WordPress

Forums

More actions when user registration (2 posts)

  1. Ahmed Hamouda
    Member
    Posted 2 years 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..

  2. NateJacobs
    Member
    Posted 2 years ago #

    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 );
    }

Topic Closed

This topic has been closed to new replies.

About this Topic