Custom User Types, Page Edit vs. Profile Edit

Recommended Posts


I recently posted in this topic, but I decided to start my own thread because while I believe my issue is related to the one in that thread, they are not exactly the same:


I have created a custom User Template in the method outlined in the docs. I am creating a directory, so it made sense that every page in the directory was a Directory Member, so they could log in and edit their own information while also keeping the entire directory protected behind a login wall.

So the new user type is created: "directory-member".

I then created two new roles: "member" and "directory-admin":

  • The "member" only has the ability to View directory-member pages, and "profile-edit", which allows them to manage their own information.
  • The "directory-admin" has the ability to edit any directory-member pages, and administer users.

Some Directory Members are both, but all have at least the "member" role.

The first hint that something was wrong was when I was testing a "member" user and I could not add a new item to a repeater on that profile. The url for the profile edit (this will be important shortly) is The repeater is set up to load new items through AJAX. If this option is turned off, the rest of this issue is no longer completely valid. But as I have found what I believe to be a pretty large issue in the Processwire codebase, I thought it worth bringing up.

See, every page (even a user) has a $page->editUrl() method, and it returns a URL like this: That's all good and fine for users that have page-edit permissions, but if they don't, that link will resolve to the admin's equivalent of a 404.

So the way that Processwire currently gets around this is by creating a specific editing area for a user to interact with only their profile: /admin/profile. And that works pretty nicely, except for the fact that nowhere is editUrl() ever made aware of the difference. editUrl() is not hookable, and whether or not a page is editable is based on the PagePermissions module.

On top of that, there are several core modules that hardcode a search-and-replace (see InputfieldRepeater.module:627) where the editing screen is for Users. This doesn't allow for a huge degree of flexibility that is offered in other places throughout Processwire. If line 627 of InputfieldRepeater is changed from this:

$editorUrl = str_replace('/access/users/edit/', '/page/edit/', $editorUrl);

to this:

$editorUrl = str_replace('/access/users/edit/', '/profile/', $editorUrl);

...the AJAX repeaters work. It's maddening!

As is brought up in the thread I attached above, a lot of the features of page editing are missing within /admin/profile/, and it just makes for an altogether strange editing experience. A user who has "page-edit" permissions for templates other than directory-member, but does have "profile-edit" permissions, will see their user in the Page List, but cannot edit their Page unless they hover over the wrench and click the "Profile" link. It just seems - off.

I think what this hinges on for me is that the editUrl() of the user should be "/admin/profile/" if that user is logged in (and their page should be editable from the Page List), or the "/admin/access/users/edit/" url; regardless of the URL, both links should resolve to the Page Edit screen, as the Profile Edit screen seems to be a unnecessarily neutered version of Page Edit.

  • Like 2

Share this post

Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By ivineets
      Whenever I try to create a repeater field on my website, I get following error:
      General error: 3161 Storage engine MyISAM is disabled (Table creation is disallowed).
      If I still continue, it creates the field but doesn't allow storing any kind of data. How do I resolve this?  Is there any alternative to repeatable content that I can use?
      Thanks for your time.
    • By cst989
      I have a file I want to access with ajax:
      The purpose of this file is to iterate through a repeater, and get the image from each entry.
      The number of images in the image field is set to 1, and just for good measure, to return a single image.
      And my code:
      // site/ajax/processImage.ajax.php?group=1206 require_once($_SERVER['DOCUMENT_ROOT'].'/index.php'); $resourceGroup = (int) $_REQUEST['group']; // get the Repeater field $resources = $pages->get($resourceGroup)->resources; foreach ($resources as $resource) { echo $resource->title; // Works as expected echo $resource->image->url; // /site/assets/files/1259/ echo $resource->image; // filename.jpg echo $resource->image->description; // nothing } See comments above for what is output, why isn't URL giving me a full URL, and no description is available?
      If I try to access $image->size() I get the following fatal error:
      Error: Uncaught exception 'ProcessWire\WireException' with message 'Method Pageimages::size does not exist or is not callable in this context' in F:\sites\<sitename>\wire\core\Wire.php:519
    • By activestate
      I'm having problems with seatching for a value in repeater.
      One of pages have attached repeater called 'insight_repeater'.
      This repeater has h1_tag (text field) and i'm trying to search for repeater items that contains 'lor' phrase.

      And right now i'm trying to do simple search, looking for phrase 'lor'. I've tried many approaches, but nothins seems to work, so i want to ask what i'm doing wrong here:

      <?php $query = $page->get("insight_repeater")->find('h1_tag~=Lor'); ?>

      Thanks for help.
    • By j00st
      Hi everyone!

      Perhaps I'm a bit enthusiastic in using the Repeater-field & FieldsetOpen combo, as I've already posted another question about it today...
      But here goes nothing
      I've got a FieldsetTabOpen which I'm using in a Repeater-field, but that's not working as expected; as in – no tabs showing 
      Instead it just shows the two grouped in FieldsetTabOpen below each other...would be great to see tabs in the repeater as well.

      To add some visuals in; In the attached images the fluor-green box is my repeater, with two checkbox fields, and after that the two FieldsetOpenTab groups.
      The other two are how I set up the fields in the repeater (Reno AdminTheme) and the current view in the CMS.
      Any tips/recommendations as to how I could go about setting this up? I've tested the FieldsetOpenTab elsewhere, it works perfectly – but then again, here I'm trying to use it in a Repeater instead of directly in a template....would I need to place the two tabs in a fieldset? Or some other ingenious construction-ideas that could help out here? Hope someone has an idea as to how to do this! Thanks!

    • By GWColeman

      I am working on a processwire project for my college. I created an entire site about a year ago without any problem. Today however, I was making some changes to the site and I was experimenting with duplicating data across multiple pages. There is a repeater on one of the pages that I need to be the same across all pages.

      I clicked the checkbox to autojoin within the field options for the repeater and processwire crashed. I am not able to make any changes to the page to uncheck and I cannot view the site any longer.
      This is the message I get on the page.
      Fatal error: Exception: Could not execute User::__construct() (in /var/www/html/wire/core/Pages.php line 323) #0 /var/www/html/wire/core/Pages.php(323): mysqli_result->fetch_object('User', Array) #1 /var/www/html/wire/core/PagesType.php(101): Pages->getById(Array, Object(Template), 29) #2 /var/www/html/wire/core/Session.php(64): PagesType->get(41) #3 /var/www/html/wire/core/ProcessWire.php(138): Session->__construct() #4 /var/www/html/wire/core/ProcessWire.php(46): ProcessWire->load(Object(Config)) #5 /var/www/html/index.php(185): ProcessWire->__construct(Object(Config)) #6 {main} in /var/www/html/index.php on line 217

      I tried to comment out 323 without any luck. I also took a look in the database to see if I could manually turn off the autojoin option. However, I was not able to figure out where the option was located within the database.
      Any help or suggestions would appreciated.
      I was able to solve the issue on my own. I did a google search and found that I needed to change he flag for the field from 1 to 0 in the database, and everything works again.

      Here is the post that I found that solved the issue.