Users

Automatically Add a Role When a Customer Buys a Specific Product

In this step-by-step guide, I will show how to automatically add a WordPress user role when a customer purchases a specific product.

Below, you will find two approaches:

Both ways are pretty good; you can choose whatever suits you best. If you’re not comfortable with the code, you can use the plugin and vice versa.

Now, let’s jump into it.

Simple Multisite User Sync

This WordPress Multisite user management plugin allows you to easily share users between sites within a multisite network (either manually or automatically).

View plugin →

Simple User Sync

The plugin allows to automatically create users on multiple WordPress websites and then sync their profile changes between selected sites.

View plugin →

WordPress Multisite User Management

If you have ever wondered how users are handled in a WordPress Multisite network, then this tutorial will definitely be helpful for you.

We will discuss various aspects of multisite user management: registrations, user roles in multisites, and associating users with specific sites of a network.

How to Add a User to All Sites in a Multisite Network

Here I will show you three ways how we can add a user to all sites in a multisite network:

  • First of all, we will do it with the help of a WordPress plugin,
  • Second, I will show you how to do it manually,
  • And finally, we will take a look at a programmatic approach (both when adding a user to a site automatically every time a user is self-registered or created in the Network Admin > Users page, and with the help of custom bulk actions).

Now, let’s dive straight into it.

Create Users Programmatically

You can create a WordPress user programmatically using either wp_create_user() or wp_insert_user() functions, so in this tutorial I am going to show you the difference between them and we’re also going to take a look at several examples.

There is also a way how you can do that with SQL-requests but it is not exactly creating users programmatically, so we’re not going to uncover it in this tutorial, but you can read more here.

Add a Super Admin User in phpMyAdmin

Sometimes when you work with WordPress multisite network you may need to create a super administrator user not from the dashboard, but from the database with the help of SQL queries.

And in this tutorial I am about to show you how. There are actually only two steps we need to do: