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 do I know if a user has a blog in WordPress Multisite?
- How does WordPress connect sites and the wp_users table?
- Auto create pages on WordPress multi site register
- Subdirectory multisite installation with several domain names?
- Can’t access WordPress multisite after connecting to domain
- In MultiSite, can some users automatically have Site Admin rights on all sites, without granting them Network Admin access?
- Domain name in a WordPress Network
- Register existing user on another site in a multisite network?
- Can i import a site (plugins, database, images) etc. Into an existing wordpress multisite?
- WordPress Multisite + Erros with URLS and ADMIN
- WordPress multisite – Bitnami
- Bulk Move Users from one site to another within a network ( Multisite )
- Multisite – getting a 404 for additional site created using subdomain install
- muliple wordpress multisite installs on the same sever
- get_last_updated() not working – multisite loop
- Programmatically creating site in a network
- What happens when someone goes to the root URL in WordPress Multisite?
- Migrate single site to Multisites with plugins, cPanel and already working subdomains
- how to install wordpress HyperDB
- Multisite Redirect for Home Page Only
- 404 not working on main site on multisite
- add_blog_option blog ID
- Cannot see dropdown shortcut to site dashboard in WordPress network why?
- How can I install WordPress as blog provider , stable?
- Automatic creation of mutisite blog outside of the admin
- List all sites created in network and get the language used for each site
- Automatically add a registered user on the wordpress multisite network even to just one other site
- Redirecting specific sites to HTTP in WordPress Multisite
- Create new multisite from existing and keep domain?
- WordPress Multisite: Login to all subsites at once
- Synchronize wordpress site between two different servers
- How do I setup WordPress Multisite in it’s own directory?
- Configuring Multisite with subdomains
- How do I remove ‘www.’ from all internal links in self-hosted multisite?
- How do I make a copy of WordPress to other folder
- MU Domain mapping
- WordPress multisite with subdirectories always redirects to mainsite
- Can i use the same content in two websites? one is the main website and one is directory website
- 404 error in dashboard of subdomain of multisite
- WordPress Multisites