Download the PHP package iandunn/wp-cli-network-users without Composer
On this page you can find all versions of the php package iandunn/wp-cli-network-users. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package wp-cli-network-users
WP-CLI Network Users
WP-CLI commands for managing users across a WordPress Multisite network.
Provides wp user delete-network and wp user set-role-network. Both can be applied to users who haven't been active in the past n days, or who have never been active.
"Active" just means that they've logged in during the given time period.
Simpler Alternatives
For simple cases, the built-in WP-CLI commands and a little plumbing is enough:
Use this if you want:
- Inactivity targeting — bulk-target users who haven't logged in within
ndays, or ever since the plugin was installed (--inactive=<days>/--inactive=never) - Speed on large networks - this is much faster than the
wp site list...loop, because it only acts on sites the user is already on, and doesn't re-load WP for every site - Flexible site targeting —
--sites=currentupdates only sites the user already belongs to;--sites=alladds them to every site; or target specific sites by ID or URL - Multiple users at once — comma-separated IDs, usernames, or emails in a single command
- Dry-run preview — see who would be affected before committing (
--dry-run) - VIP-aware inactivity — automatically incorporates WordPress VIP's
wpvip_last_seendata when present, so users active via VIP before this plugin was installed are still handled correctly - Convenience - you don't have to remember or look up how to pipe site URLs to
xargs - Using usernames or emails when reassigning content, instead of having to look up IDs
- Super admin protection on delete — super admins are skipped by default; opt in with
--include-super-admins
Installing
-
Ensure your
composer.jsonhascomposer/installersand the plugins path configured. Most Composer-managed WordPress projects will already have this. -
Install the plugin:
- Activate the plugin:
Commands
wp user delete-network
Delete users network-wide, with optional content reassignment.
Flags:
--users=<users>— Comma-separated list of user IDs, usernames, or emails. Mutually exclusive with--inactive.--inactive=<days>— Target users whose most recent activity is older than this many days. Mutually exclusive with--users.--inactive=never— Target users with no activity record. Mutually exclusive with--users.--reassign=<user>— User ID, username, or email to reassign all content to. Mutually exclusive with--no-reassign.--no-reassign— Permanently delete all content belonging to removed users. Mutually exclusive with--reassign.--scope=<scope>—sitesremoves users from all site memberships but keeps their network account.networkalso permanently deletes the account. Required.--include-super-admins— When using--scope=network, revoke super admin status before deleting. Without this flag, super admins are skipped.--dry-run— Show what would be changed without making any changes.--yes— Skip confirmation prompt.
Before deleting, shows a confirmation table with ID, username, email, site count, super admin status, and last login date.
wp user set-role-network
Set a role for users on every site they belong to across the network. Leave off --role to default to subscriber.
Flags:
--users=<users>— Comma-separated list of user IDs, usernames, or emails. Mutually exclusive with--inactive.--inactive=<days>— Target users whose most recent activity is older than this many days. Mutually exclusive with--users.--inactive=never— Target users with no activity record from either source. Mutually exclusive with--users.--role=<role>— Role to assign. Defaults tosubscriber.--sites=<sites>— Required. Which sites to update:currentonly updates sites the user already belongs to;allupdates every site in the network, adding users to any they're not on; or a comma-separated list of site IDs or URLs (e.g.2,foo.example.org,example.org/bar).--dry-run— Show what would be changed without making any changes.--yes— Skip confirmation prompt.
Before updating, shows the same confirmation table as delete-network.
Notes
- Inactivity is determined by the most recent of two timestamps: this plugin's own
network_users_last_login(recorded at login) and WordPress VIP'swpvip_last_seen(recorded on each page load), if present. Whichever is newer wins. - ⚠️ Users with neither timestamp won't be matched by
--inactive=<days>. Use--inactive=neverto target them specifically. - This is only intended for Multisite networks, and hasn't been tested in single sites.
Contributing / Setup
See CONTRIBUTING.md