[wp-trac] [WordPress Trac] #36860: Introduce filter for users_have_content within delete action of users.php
WordPress Trac
noreply at wordpress.org
Tue Mar 19 16:16:32 UTC 2019
#36860: Introduce filter for users_have_content within delete action of users.php
-------------------------------------+------------------------------
Reporter: garrett-eclipse | Owner: garrett-eclipse
Type: enhancement | Status: accepted
Priority: normal | Milestone: 5.2
Component: Users | Version: 4.6
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses: administration
-------------------------------------+------------------------------
Comment (by garrett-eclipse):
Replying to [comment:16 birgire]:
> The following question comes to mind:
>
> If we have some some custom user content, that's only added via some
plugin and not stored in the posts or links table, how would one handle
here the actual reassignment/removal from the db?
>
> I think it would be nice to have a simple example to better understand
how one could approach this problem, e.g. using this filter and how to
reassign/delete the data.
Thanks @birgire I appreciate you testing.
As to your question on how a plugin would handle any removal/reassignment;
This is already available and being used throughout many plugins as the
`delete_user` and `deleted_user` actions are available and used to remove
and re-assign data.
For a specific example Co-Authors Plus already handles delete and reassign
using the `delete_user_action` here;
https://github.com/Automattic/Co-Authors-
Plus/blob/4e1b2d4c80bf28169bef5d8a1c77e95489acf042/co-authors-
plus.php#L943-L988
This new filter is to correct a limitation of WordPress where it won't
allow plugins to enable the re-assign screen when they have custom data
but the user doesn't have any standard WP data.
In many cases plugins already have the delete/reassign logic in place and
would just be able to use the new filter to ensure full coverage on delete
so if their plugin has user data that's available for re-assignment.
That being said I agree, I believe a nice example should be cooked up for
the Codex to illustrate how to use the filter, and then we can reference
the `delete_user` action and add another example there for the actual
reassignment/removal.
If we're able to wrap up testing I feel we can make RC1 and then can
continue work on the docs and codex once it's in trunk.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36860#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list