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');
This example makes a directory in uploads/user_dirs
.
http://codex.wordpress.org/Plugin_API/Action_Reference/user_register
http://codex.wordpress.org/Function_Reference/wp_mkdir_p
Related Posts:
- How to stop showing admin notice after close button has been clicked
- Namespaces in WordPress – How do I initiate the main class?
- What areas to Unit test while building a plugin?
- Which method is best to enqueue scripts
- WordPress Capabilities: edit_user vs edit_users
- Function to activate WordPress theme inside a plugin
- What is the correct way to check if WP_Filesystem can write to a directory without aking for username / password?
- Is there a WordPress Plugin that allows voting “does this coupon work” on specific links like Retailmenot
- Pass A Value From Outside To A Plugin Variable
- shortcode doesn’t work
- Built in admin ajax hooks?
- Force plugin to fail activation
- Could someone please help me to add category id with in this query so this will return posts from a certain category?
- How to handle autoloading with composer by keeping the WordPress naming conventions?
- Current user in plugin returns NULL
- What are the benefit in adding hook in the init() hook?
- How can I implement a notification system in wordpress?
- Minimum PHP Required for WordPress
- building plugin and it is displaying above plugins page
- load_theme_textdomain path
- Dynamic CSS Vs Inline Issues in Code any Way around in a WordPress Themes?
- Is license need for free wordpress plugin
- plugin development: problem with functions
- Getting a List of Categories for Use in a Plugin?
- Create entire wordpress as a github repositery?
- Building plugin with changeable custom post type values…advice needed
- How to get all of the activate_plugin action parameters?
- What can be reason for no plugin-strings available under stable section on translate.wordpress.org?
- Conditional attributes and logic per product category
- Why Is This Code Causing The Admin Bar to Disappear?
- WP_Terms_List_Table Quick Edit not working
- Displaying Custom Sidebar Without Modifying Theme’s Core File?
- Is there a directory my plugin can write files to that cannot be viewed via the browser/url?
- WordPress checkbox and Illegal string offset
- Is it fair to use MIT licensed code in WordPress plugins? [closed]
- How to add an element right after the article using jQuery?
- How to reset wordpress but not plugins and settings
- Include a php file from another plugin
- How do I make a secure API call from a shortcode when a button is clicked?
- WordPress REST API Plugin Development – Add Custom Endpoint
- Hook into the rendering of a WordPress Template
- Can the uniqueness of the plugin file/plugin slug and version number be trusted?
- Save user total active time after login in wordpress [closed]
- WordPress gtag.js with User ID tracking
- Switch from wp-cron to a server cron job
- Calling a save function from a “submit” button
- How to Show Author image and url in WordPress plugin directory? [closed]
- WordPress plugin: efficient way to store large data
- jQuery code didn’t run on my plugin
- The Events Calendar Plugin – List View Background Colour Issue [closed]
- Select Form Element Not Saving from Plugin Options
- My widget won’t update its values when save is clicked
- Custom characters of tinymce editor are saved as question mark
- Can we give Pending as a Role to wp_insert_user?
- How do I profit from a Plugin?
- How to automatically activate users after registration without activation email?
- Themes conflicts and overrides my WordPress Support widget Plugin styles
- Disable Author Archive just for certain roles in bulk
- Seperate plugin and theme files
- Pass PHP variable to javascript
- Table of contents (TOC) plugin is not showing header tag
- Custom page from wp admin area
- Unexpected add action function in WP plugin
- Avada Live is broken on WP
- I created a plugin with ‘view page’ that uses MYSQL + PHP. When I use wp_insert_post(), it turns everything to HTML
- list of custom post by custom field in frontend
- How to implement color picker from WordPress in my boilerplate plugin?
- custom post type plugin error [closed]
- Make downloadable ebook read online without download option
- WordPress rewrite rule depend on meta values not ids
- Problem with wordpress has_action() function
- Offering a freemium plugin (a free version + paid version)
- In woocommerce, is there any way to empty wordpress default mini cart when order placed?
- Admin menu hilighting wrong item for CPT
- ajax voting for custom post type
- Making a Custom Post Type Plugin – keep getting the white screen of death
- Limit Google Ads to particular blog posts
- Communicating to plugins from webserver
- Buddypress Member list not showing admin and mods
- Inactive Plugin Files
- Hook into install email
- Shortcode in a blog post, footer and related products stop working
- Editing a built plugin: How to activate it only on a single post page
- Autoloading a PHP class – working outside, but not inside WordPress plugin
- Saving an array to get_options
- Linking Plugin Files to WP
- Plugin – including external javascript calling google maps
- Help me with my first very basic plugin
- HTML link within my plugin settings page
- How to create post comparison in wordpress
- How can I create a navigation menu in the sidebar that can also act like a slider?
- How to create a sharing marketplace with wordpress for bicycles?
- How to set meta-data for my plugin
- WordPress isn’t sending welcome email with the password reset
- A splash page on landing page
- Inline AJAX script passing variables to PHP
- CPT template is not being automatically used single post pages
- How to trigger plugin migration code when plugin updates?
- How to Save Category and Delete Category in same Function
- claim a permalink and all sublinks in plugin