Jump to content

Better support for unpublished users in admin


Robin S
 Share

Recommended Posts

Users are pages, but in the Users section of the admin there isn't the same support for unpublished users as for unpublished pages.

When users register on the frontend I set their status to unpublished until their email address is validated (thanks to a suggestion in the forums from Soma). But while users are unpublished it isn't possible to make edits to their profile via admin because there is no "Save and keep unpublished" button like there is for other pages. To save changes in admin the user must become published.

Also, there is no ability to unpublish a user from admin. This would be a useful option if a user account needs to be suspended rather than deleted.

Edit: another small thing that would be nice to have is for the user list to honour the useHoverActions config preference for PageList. I keep hovering on the user list and then I remember I have to click the name to get the flyout links.

  • Like 7
Link to comment
Share on other sites

You could go with a activation link via email - so you can simple validate new users and set them activ via a email link...or in the backend and by setting activate_user to sero...or go with two different roles user_active and user_pending....you have multiple options to implement a comfortable managment via Lister pro or something else...

link for a really good activation solution:

https://processwire.com/talk/topic/4066-activate-user-account-via-email/

regards mr-fan

  • Like 2
Link to comment
Share on other sites

Thanks @mr-fan, I'm familiar with that thread and I am activating users via an email link. But in principle I think unpublished/published users is the ideal way to have users in an inactive/active state. That's what the published status of a page is for, so it shouldn't be necessary to add a new field for the same purpose. And it also has the benefit of preventing login and view access for unvalidated user accounts without the need for additional logic in login functions and page templates.

  • Like 5
Link to comment
Share on other sites

There's a little bit of trickery involved when adding back a "save unpublished" button for user pages as InputfieldPassword has its own little piece of logic that sets itself to required when processing input for an unpublished page, but here's a quick-n-dirty attempt at a module.

Nice one. I also employed a little trickery in my EmailNewUser module, although I took a slightly different approach. 

$this->addHookBefore('InputfieldPassword::processInput', $this, 'removeRequired');
public function removeRequired(HookEvent $event) {
    $event->object->required = false; //hack to remove required status so that automatically generated password can be added on save
}
  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...