Jump to content
bernhard

Cannot select users in page field

Recommended Posts

Hey!

I have a strange problem with a pagefield. As SuperUser everything works fine, but as "admin" I cannot select the "client" for a "training":

NIiRrNe.png

The field is set to this:

IEVQrUR.png

And the label field is "fullname". As SuperUser it just works fine:

N9B8IIs.png

And the search also works (as admin):

8PzTx6L.png

Any ideas?

Share this post


Link to post
Share on other sites

You need to add "check_access=0" to the selector.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

You will also come up agains this: https://github.com/processwire/processwire-issues/issues/550

This will fix that issue:

$this->addHookBefore('Pages::find', function(HookEvent $event) {
    $selector = $event->arguments(0);
    if(is_string($selector) && strpos($selector, 'template=user') !== false && strpos($selector, 'name|first_name|last_name%=') !== false) {
        $selector .= ', check_access=0';
    }
    $event->arguments(0, $selector);
});

PS - you might need to adjust the modified selector to suit your needs - re the first_name, last_name etc

  • Like 5
  • Thanks 1

Share this post


Link to post
Share on other sites

Alternatively you can hook after ProcessPageSearch::findReady to make it a bit more specific to autocomplete:

 

  • Like 4
  • Thanks 1

Share this post


Link to post
Share on other sites
3 hours ago, Robin S said:

Alternatively you can hook after ProcessPageSearch::findReady to make it a bit more specific to autocomplete:

Thanks @Robin S - you just reminded me to update to that version - cheers!

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...