Regarding the update part in your question:
I think the problem here is that you’re missing the number of accepted arguments in your add_action()
setup.
If you check out the Codex, the usage is:
add_action( $hook, $function_to_add, $priority, $accepted_args );
where by default $priority = 10
and $accepted_args = 1
.
So your code snippet should be like:
add_action ( 'wpmu_activate_user', 'assign_user_to_blog', 10, 3 );
function assign_user_to_blog( $user_id, $password, $meta )
{
$role = isset( $meta['role'] ) ? $meta['role'] : 'dmd';
add_user_to_blog( 3, $user_id, $role );
}
but the $meta
variable is undefined in your previous code snippet.
When developing you should remember to use WP_DEBUG
to watch for PHP errors, warnings and notices. Check for example the Debugging in WordPress in the Codex.
Related Posts:
- Activate User account for Sub Site broken
- Activation of new Registered site fails on multisite
- How to run an activation function when plugin is network activated on multisite?
- How can I un-reserve a pending username registration?
- wordpress multisite, how to keep user on subdomain throughout registration process?
- Customizing wp-activate.php
- Allowing periods in usernames
- Remove Site Name from register form – Multisite
- Prevent user creating new users with specific roles
- Get first_name and last_name on user_register hook
- Is there a wordpress function to cleanly delete an entry in the signups table?
- WordPress 3.2(Multisite) – How to add custom user meta fields to signup form?
- How to add multiple existing users to a multisite site?
- WPMU – new users are automatically subscribed to the main blog – how to prevent that?
- User registration on sub site
- Disable domain redirect
- Displaying a message upon user registration
- What sites are you registered to when joining a multisite?
- Add a user to a specific blog when they register?
- How do you disable account activation in WPMU and then log the user in right away?
- Auto creation of multisite blog on user registration
- Multisite – user email activation links broken
- Add menu items/actions for multisite users who are registered on the network but do not have a role or capability in any sites
- Four columns in the wp_users table
- WP MU Register User across all blogs
- Is the Multi site functionality a viable option for Country and Language targeting?
- Using the standard WordPress “New User” interface on a multisite
- How can you override the is_multisite check in wp-login.php for individual login/registration?
- How can I create blog specific database table in multisite?
- How can I manually activate a new site in a wordpress multisite network?
- User registration on two sites in same multisite
- How to change a user role after registering in multisite?
- Create a CSS file in plugin folder when theme is activated
- How to fix that new users show up again in subsite of a Multisite?
- Activation Account Email
- User registration is currently not allowed
- Multisite ‘Welcome User Email’ SITE_NAME returns ‘network’ name, not the name of the blog
- User registration on wordpress multisite
- Easily adding multiple existing users to a multisite site
- Automatic registration on main site upon user registration on Multisite
- Register a user only to the root blog – WP Multisite
- Possible to have duplicate usernames on different two multisites
- How to allow mixed case characters in multisite site name?
- Modify new user email notification in network admin screen wp multisite
- Users getting linked unwanted to main mu in WordPress multisite (WPMU)
- Can’t activate a user on multisite install
- WordPress Multisite Network Subdomain
- Multisite: How to bypass wpmu_signup_user_notification and add my own notification logic?
- Allow users to register on multisite through WooCommerce using the same email address
- A different role for each site in a multisite
- User registration problem on multisites web
- Multisite “Skip Confirmation Email” Log Out Problem
- Multisite – User creation for second site from first site?
- How to Create WPMu New User?
- Possible to set new user’s site time zone at user creation using Gravity Forms?
- multisite registration: check existing subdomains while typing
- Plugin De/Activation Not Firing On MultiSite install
- Registration Page
- Using a number for limiting registering or banning on multisite
- How to use same email for multiple users? [duplicate]
- How to use WordPress Multisite With Different Domain Names?
- How To Add Custom Form Fields To The User Profile Page?
- Where are available Roles Defined in the wp_ database?
- restore_current_blog() vs switch_to_blog()
- Can i merge 2 new WP_Query($variable) ‘s?
- How to disable a network enabled plugin for just one site?
- How to reliably flush rewrite rules on multisite?
- Site Redirecting to wp-signup.php
- Moving a WP Multisite to a subdirectory
- Cookies in multisite where network sites have their own domain name
- Convert a Multisite WordPress install into a Single site
- WordPress MultiSite Active Directory integration and site privacy
- WordPress Job Interview Preparation
- How to add Custom Blog Options to new blog setup form?
- How can I trust switch_to_blog()?
- Remove the blog slug from WordPress Multisite root node
- Why are my roles not visible in a Multi-site/Network?
- Site admin in a network install can’t edit users?
- How to use same email for multiple users
- Specific upload folder for PDFs in custom Post type in WP multisite
- What is the correct way to map multiple domains in a WordPress 4.1 multisite install?
- Where can I find documentation on what characters are allowed in user names and why?
- How to migrate subsite from dev multisite to production multisite
- How do I remove/delete an old super admin user?
- DB connection error after copying a WordPress Multisite instance to a second location
- Redirect Main Site to Subsite in Multisite WordPress
- Is there a is_user_logged_in() for multisite?
- Switching MultiSite installation from HTTP to HTTPS
- Allow user to select a theme to install when they signup
- Setting up a wordpress network with third level domains
- Get upload URL by blog ID in multisite
- What’s the difference between get_site_option and get_blog_option?
- Need help sorting “My Sites” Alphabetically
- How to delete post revisions?
- Create mobile site with same content just different theme
- Add additional Network constants to wp-config.php dynamically
- Multisite stuck at 1MB for max file size
- How to get blog name, when using WordPress Multisite
- What are options are there to implement a multi language site
- Prevent network activation of plugin