admin管理员组文章数量:1336173
One solution is to remove all roles.
But the user will still be able to log in. Should we at the same time delete password?
Scenario:
Users "delete" their account and account is set to innactive in our system. 2 months later, the user want's to sign up again.
Since e-mail is already registered, he gets a message that the email exists.
What do we do now?
Well, if user request a new passord, he will get one. But he still doesn't have any user roles.
Doe anyone have any suggestions on how this may be solved?
One solution is to remove all roles.
But the user will still be able to log in. Should we at the same time delete password?
Scenario:
Users "delete" their account and account is set to innactive in our system. 2 months later, the user want's to sign up again.
Since e-mail is already registered, he gets a message that the email exists.
What do we do now?
Well, if user request a new passord, he will get one. But he still doesn't have any user roles.
Doe anyone have any suggestions on how this may be solved?
Share Improve this question edited Apr 13, 2017 at 12:37 CommunityBot 1 asked Jan 20, 2012 at 15:15 StevenSteven 2,6207 gold badges41 silver badges61 bronze badges 5- How do your user roles work? Is it just one user role that needs to be applied, or are there varying user roles for various clients? – mor7ifer Commented Jan 20, 2012 at 15:36
- Different custom roles, but they all have one base role. No one has WP roles (except me and my staff) – Steven Commented Jan 20, 2012 at 16:49
- I'm not completely removing the user, because there is data linked to the user that will not be removed even if users deletes account. Thereore we only want to set the account to inactive and delete user data. – Steven Commented Jan 20, 2012 at 16:51
- And inactive is a user role? – mor7ifer Commented Jan 20, 2012 at 17:21
- No. I've not come up with a sensible idea how to set user inactive. – Steven Commented Jan 20, 2012 at 18:14
2 Answers
Reset to default 3how about just setting user meta. Something like 'my_inactive' and set it to true, then you can evaluate by something like if( get_user_meta( $user, 'my_inactive' ) === true )
and have a quick way to check that without destroying any of the user privileges or anything. This will allow you to hook login and just prevent the user from accessing the backend, rather than changing any of their account settings. The way you would allow users to reactivate would be by adding a link to /wp-login.php which would send a reactivation request to you, and allow you to move from there (or just autoreactivate). If you need any sample code, let me know and I can whip something up. I'm not sure which hooks in particular you'd need off the top of my head, but I'm pretty sure most/all of them exist.
You can set the delete account to an "inactive" role. If they register again, simply set their user to one of the default roles in WP. You can create a role called "inactive" via a plugin.
for example: http://wordpress/extend/plugins/user-role-editor/
HTH
本文标签: How do I set user account inactive
版权声明:本文标题:How do I set user account inactive? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742402541a2468174.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论