Jump to content

How to show "Users" page to a non superuser?


arjen
 Share

Recommended Posts

I've setup a small member system. A new member can fill in a front-end form and is saved as an user who is not published. The editor of the site (no superuser) gets an e-mail that a new account has been made. 

Since I'm a superuser I can access the Users page in the treelist. It would be nice to show the Users page outside of the admin pages. I've tried to move them, changed permissions on the admin template, changed permissions on the user template. 

post-365-0-15609700-1362563520_thumb.png

This is how I've setup the editor role to view the admin template.

Is this possible? Or do I need to build a module? If so, any pointers to existing modules where I can mimic some features?

Link to comment
Share on other sites

Hi arjen,

You must give your editor role this permission : "Administer users (role must also have template edit access)".

+ the Editor needs edit permission on your User template.

Can the editor see the users now if you move the Page outside of "admin"?

  • Like 2
Link to comment
Share on other sites

That works, thank you Wanze! Users with the 'editor' role can now see the users in the top menu using the Access page. Still can't move it in the tree view. Not much of a problem since they are accessible.

Do you also know how to manipulate the table of users? The tree shows if a page (in this case a user) is hidden or unpublished. The table with users doensn't. This might be a nice UI touch to show an editor which users are published.

Link to comment
Share on other sites

Didn't know that. ProcessWire keeps getting better. Thanks for your time, Wanze!

I will try to figure out how to strike-through or dim an user who isn't published in the table.

  • Like 1
Link to comment
Share on other sites

Probably, soma :)

Next challenge: the table is partially empty because only superusers can see unpublished pages (in this case users). Is there a way to show all users to non superusers?

Link to comment
Share on other sites

I actually wouldnt take the route to give editor admin rights just for this. It relatively simple to create a dediacted admin page that lists unpublishes users. It much more confident to do this. Let us know if you need example.

  • Like 1
Link to comment
Share on other sites

That's what I thought. You recommend using a module? I think I can create one to display all the users and their status. If I run into any challenges I'll report back. Thanks Soma!

Link to comment
Share on other sites

Ahh, sorry now I get it, forget it unless you want to really create one. The administer user permission of course... :) I don't know why unpublished users would be invisible, maybe unintended.



Just tested also and it seems to work fine.. I see unpublished users and can create and delete, edit users.

Link to comment
Share on other sites

Soma, are you logged in as a superuser? When I look as a superuser I see them all, including guest and unpublished ones. When I look as the editor (with Administer user permission and the user template access) I only see the published ones (also guest is not showing up).  

Link to comment
Share on other sites

No I'm logged in with a editor user. Admin and guest user are excluded yes but others visible.

Have you enabled edit access to the user template for editor role?

Yes the unpublished users don't have a strikethrough as I think it was missed to add.

Link to comment
Share on other sites

When I tried this locally it didn't seem work. I've done some other work, updated PW and deployed the website. Setting up some new stuff as well and now I can see the unpublished too. I must have done something wrong locally. 

I still want to extend this list so I might create a module to handle some useractions a little easier (set unpublished) if the client wants it.

Link to comment
Share on other sites

Arjen, you don't necessarily even have to create a module for this. You could just add a template, then create a page with it in the admin, like you would on the front-end of your site. This is something I often do just because it's sometimes quicker than creating a dedicated module. Adding a page in the admin can be technically no different than adding one on the front-end of your site. So listing all users could just be a matter of creating a template like below, and then creating a page in your admin:

include("./head.inc");
foreach($pages->find("template=user, include=all") as $user) {
  echo "<p>$user->name</p>";
}
include("./foot.inc"); 
  • Like 1
Link to comment
Share on other sites

Ryan dont you think users unpublished should have strikeethrought?

Probably so, I agree. Though stepping back to the idea of unpublished users: they don't really have a purpose other than short-term, between page edits. When you create a user, it doesn't give you the opportunity to "Save and Keep Unpublished". So the only way that an unpublished user exists is in-between the time that you create a user on the screen asking for the name, and the time that you save the user after entering their email address, etc. Or if you create the user, and don't finish.

Link to comment
Share on other sites

Thanks Ryan for stepping in.

For me the unpublished users are quite useful when using them for front-end purposes. When an (non-admin/non-backend) user registers I set them unpublished. This way they can't login. I'm working on a small module to set a user (un)published from the backend. I think this workflow is quite in line with the overal ProcessWire experience.

  • Like 1
Link to comment
Share on other sites

  • 8 months later...

I have this situation:

I have users with a role 'partner', They have a folder in the tree where they have they have custom rights. ( based on PageEditPerUser).

Now when I unpublish their "HOME" folder, I wish to prohibit access to the admin for all 'partners' who have custom access to that folder.

It's working, but there's no visual feedback. (no strike-through)

  • Like 1
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...