Jump to content

adrian

PW-Moderators
  • Posts

    11,204
  • Joined

  • Last visited

  • Days Won

    373

Everything posted by adrian

  1. The only thing to add to LK's comments is that it's nice to have everything in the one place - I have my public repos on Github, so having the private ones there also is nice. That said, I like the OS nature of Gitlab and the unlimited collaborators, so it really depends on your needs and maybe these are project specific?
  2. Yep d() for dumping to the current output (either the console results or the template file where you call it from), or bd() for bardump which dumps to a dedicated Dumps panel on the Tracy debug bar.
  3. Nice! Interesting you figured out using count for an exact match. In the same multi-parameter selector mentioned in the linked post, I use count to find messages with either all the age categories checked, or alternatively, it has at least the user's age category checked. This is used because the user's age is not a mandatory field to be completed so if we don't know their age, we need the message to be for all ages, but if we do know their age, then it must match the ages tagged in the message. $selector[] = 'ages=(ages.count='.$pages->count('template=age'), ages=(ages='.$user->age.')'; Anyway, obviously getting away from the purpose of the thread, but it's another example of how using a count can be helpful for queries.
  4. Sensational, Brilliant, Fabulous ? Now this is something we definitely need in the core - I can't believe someone hasn't realized that we can't already do this. I think we need to nominate Robin as PW support guru of the year!
  5. It's a Wordpress thread, but it's a great explanation so I thought it was worth linking to: https://wordpress.org/support/topic/why-is-it-an-error-to-have-a-closing-tag-in-functions-php/#post-10430549
  6. @MarkE - just be aware that hook doesn't prevent a user getting access to the pages via Pages > Find and also via the Live Search in the menu bar. There are some hooks in the Admin Restrict Branch module that will help you with that though.
  7. Thanks for confirming that I am not senile just yet ? This is what I am using, where 1145 is the parent of the "user_types" page reference field. Not terribly elegant, but it seems to work ok. I'd love to see a better solution though.
  8. Hey guys - I am feeling like a PW noob asking this one. Maybe it's a slack of sleep getting this current project out the door, but I am trying to do something that I feel should be easy, but doesn't seem to be. I have users with various possible user types. This user_types field is on the user template and is also on the "message" template, so trying to match up users with messages that are appropriate for them based on the user type they are and the message tagged for their type. It's easy to get messages that match one of the user's types: $pages->find("message=template, user_types={$user->user_types}") but because users and messages can both be tagged with more than one type, I don't see any easy way to force an exact match of the user_types between the user and messages. Separating the user_types out into an AND selector like: user_types=type1, user_types=type2 isn't enough either because that doesn't enforce those types that aren't selected, so you also need to add like so: user_types=type1, user_types=type2, user_types!=type3 That last one does what I want, but I feel like the page reference field getMatchQuery() method should support exact matching without having to spell it out like this. Is there a syntax I have forgotten that does this?
  9. You need to give it a template, name, title:
  10. The "Copy Content to Other Field" action in Admin Actions could do this, although currently it does it for all pages of the selected template, but wouldn't be difficult to modify to add an additional page selector:
  11. Can you show the code from the entire page? Is it maybe a PHP short tags issue, or a character encoding issue? Do you have PW debug mode on? Does that code work in the Tracy Debugger console panel? Just trying to isolate it.
  12. Thanks @Robin S - you just reminded me to update to that version - cheers!
  13. Nice one @Autofahrn Here are the results of your script without the set_error_handler() but with Tracy handling everything instead:
  14. It can be if you persist hard enough with DB modifications and other trickery, but that module is the devil incarnate for sure ?
  15. All you have to do is start a User Switcher session and then click the logout button - that is the same as selecting guest. Oh yeah, and good idea about using the User Switcher - sorry, too rushed to think of that this morning ?
  16. So sorry @bernhard - I didn't read that bit of your question - my apologies! I have purposely prevented the Console, File Editor and Adminer panels and some others from working for non-superusers. Perhaps this could be made optional, but it seemed like a good default security setting. I can work on this later for you, but for now, just remove this line: https://github.com/adrianbj/TracyDebugger/blob/b225975afdad1c86ecb7ac7d4a724b46dcbcd0f0/TracyDebugger.module.php#L1444 and this conditional: https://github.com/adrianbj/TracyDebugger/blob/b225975afdad1c86ecb7ac7d4a724b46dcbcd0f0/includes/CodeProcessor.php#L20 I think those should get you going.
  17. Can you remove the islocal check on this line: https://github.com/adrianbj/TracyDebugger/blob/b225975afdad1c86ecb7ac7d4a724b46dcbcd0f0/TracyDebugger.module.php#L2477 and if that works, then we know it's an issue with that check in your environment.
  18. Typically Tracy reports on AJAX errors - if not in the AJAX debug bar, usually in the Tracy error logs. Sometimes they do seem to get through but usually they show up in the browser console's network > response tab
  19. Or are you maybe using ngrok? Maybe that is affecting the detection of local via 127.0.0.1
  20. Hey @bernhard - the "Force guest" setting should take care of that on localhost, but IIRC there are some dev environments that aren't correctly recognized as local - are you using one of these pre packages LAMP stacks? If that doesn't work, have you tried giving the "tracy-debugger" permission to the user role in question? Obviously you won't need to worry about the IP restriction in your dev environment.
  21. 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
  22. You need to add "check_access=0" to the selector.
  23. Hey @kongondo - I am back working on that project that makes heavy use of this field and I just replaced the: return $this->renderMarkup($page, $field); with: return true; for the sleep, wakeup, and loadPageField methods and it is bringing calls to the render method back to just one, which is really important because it contains some heavy querying. I am fine with this mod for my needs, but I wonder if you'd consider these as an option for when the module is only used in the admin. The render() method in the InputRuntimeMarkup file takes care of the actual rendering without all these duplicate calls to renderMarkup(). What do you think?
  24. @bartelsmedia - thanks for the heads up. I think you can achieve your needs quite easily via the "Login Template" option. Hope that helps. @SwimToWin - sorry I let your post go by un-noticed. I am afraid I don't really have the need (and hence the time) to add a single passphrase option, but I am certainly open to a PR if you're willing. A tad OT, but I think PW needs to start fostering a culture of providing PRs more often than requests for features (both in 3rd party modules and in the core). This is absolutely not directed at you personally - I just feel like we need more contributors across the board because there are too few people being spread way too thin.
  25. You may also need to grab the ->first() image from the images field, or add another nested foreach to loop through all images, eg: <?php echo "<h1>$page->title</h1><br>"; ?> <? foreach($page->we as $member): ?> <? foreach($member->images as $image): <img src="<?php echo $images->url; ?>" alt=""> <? endforeach;?> <?php echo $member->wemember; ?><br> <? endforeach;?>
×
×
  • Create New...