Jump to content

[solved] page reference field - unpublished pages not visible by non-superuser roles/users


formulate
 Share

Recommended Posts

On 12/23/2022 at 8:20 AM, Robin S said:

@gebeer, the findReady method is working for me:

$wire->addHookAfter('ProcessPageSearch::findReady', function(HookEvent $event) {
	$selector = $event->return;
	if($event->wire()->user->isSuperuser()) return;
	// If the selector looks like it comes from a particular autocomplete Page Reference field
	// (I wish this method provided a better way of working out where the selector is coming from)
	if(strpos($selector, 'parent_id=1329, templates_id=62,') === 0) {
		$selector .= ", include=all";
		$event->return = $selector;
	}
});

 

I can confirm that this hook is working on a clean PW3.0.208dev install. So problem is somewhere within my other install.

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