Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#56207 new enhancement

Multisite: record when a user is added to a site

Reported by: daledupreez's profile daledupreez Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Users Keywords:
Focuses: multisite Cc:

Description

This is a relatively small feature/enhancement request to record when a specific multisite user gets added to a site. Right now, we can detect whether a user is a member of a site, but the user_registered field on their user reflects their original user registration date, which doesn't reflect when they were added to any specific site, and may not be information that should be shared with site-level users.

Change History (4)

#1 follow-up: @daledupreez
2 years ago

In terms of implementation, this could be handled via a new user_meta field, e.g. user_added_to_blog_date that gets written by add_user_to_blog().

It is also completely possible for this to be implemented via the existing add_user_to_blog action, so it may not make sense to have this be a Core feature.

#2 @johnbillion
2 years ago

  • Version 6.0 deleted

Thanks for the ticket @daledupreez . Out of interest, what's your use case?

#3 @daledupreez
2 years ago

The specific use case is where site-level administrators are permitted to add and manage users at the site level, and it would be helpful for them to know how long specific users have had permissions on the specific site i.e. when they got added to that site.

In general, this is probably on the side of "nice-to-have", but is more likely to be helpful when trying to work out the following on sites with lots of users:

  1. How long a user has been linked to the site, which is more useful if you're a new site admin
  2. Whether a user may need a reminder or other action when they have been inactive on a site for a long time

To support those use cases, we'd display this information for the site-level user list, likely in place of user_registered.

I am also realising that we'd need to remove the record when the user is removed from the site.

#4 in reply to: ↑ 1 @markparnell
2 years ago

Replying to daledupreez:

In terms of implementation, this could be handled via a new user_meta field, e.g. user_added_to_blog_date that gets written by add_user_to_blog().

One small note - the meta key would need to include the blog ID as you'd need a separate value for each site, e.g. $wpdb->prefix.'user_added_to_blog_date' (or perhaps $wpdb->prefix.'user_added_date') along the same lines as the capabilities meta record.

It is also completely possible for this to be implemented via the existing add_user_to_blog action, so it may not make sense to have this be a Core feature.

Yeah, I'm inclined to think that this is plugin territory.

Note: See TracTickets for help on using tickets.