Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by LAPS

  1. Hi @adrian, thanks again. 1) OK. 2) Because LRP is a commercial module, I cannot share the code. Maybe @ryan can illuminate us about it.
  2. Hi @adrian, thanks for the support. I (and I think almost any developer) am a bit reluctant to change the source code directly. It should work as-it-is. The enablement of the "Rename on Save" option helps with LoginRegisterPro (LRP). However, I find it a bit negative for performance reasons in addition to breaking file links. Can we expect in a future release of the module to allow selecting the user template and renaming LRP profile image just on upload?
  3. @Andy my problem is not related to check if the users have or not have the profile image set but to publicly display their image file. Because the user pages are located under PW Admin > Access > Users, (normally) their profile image is not accessible to the public, and I would like to make those images publicly visible the right way. BTW I'm using LoginRegisterPro features to allow users to edit their profile image.
  4. I would like to publicly display image files of users e.g. a profile picture on the front end and I've searched the forum without much success to find a satisfactory solution for my case, probably the most common one. The problem in displaying user images is that the user pages are located under PW Admin > Access > Users, which prevent image files to be loaded on the front end from the related access-restricted assets/files folder. In my case, I've the profile_picture Image field in the user template and I cannot move the user pages outside PW Admin > Access > Users. How did you solve this? P.S.: I'm sure this is a common case for many PW developers and can be useful for PW newcomers, and I hope answers to this topic will be so good to many people that, perhaps, I'll need to change the title of this topic to something like "How to display user images on the front end (The Ultimate Guide)".
  5. Hi @adrian, I would like to use this module for auto-renaming the profile image of users when using the LoginRegisterPro module. Two things: In the module settings, the "Enabled Templates" option hasn't the user template as a selectable option. Note: in my case I think selecting by template is better than selecting by pages ("Enabled Pages" option) because I've users under multiple parents. The module seems do not work for the LoginRegisterPro profile action/form. Any help?
  6. I confirm that disabling Tracy Debugger worked for me. I've installed latest (at the time of writing) version: 4.23.41
  7. @adrian, thank for pointing me out to a possible solution. I'm trying SwiftDefaultApps and added the 'netbeans' URI Scheme to it. Now, when I click on the link in the Tracy panel the NetBeans app opens but the file (and the line) doesn't open. In Tracy Debugger module settings, I tried to set 'Editor protocol handler' as follows: netbeans://open?file=%file&line=%line netbeans://open/?url=file://%file&line=%line netbeans://file/%file:%line ... and some more, without success.
  8. @adrian I tried to set Editor protocol handler: netbeans://open?file=%file&line=%line Local root path: /Users/<MyMacOSUserName>/NetBeansProjects/<MyProjectFolder>/ That in the Tracy panel outputs the link (which seems to be correct) as follows: netbeans://open?file=/Users/<MyMacOSUserName>/NetBeansProjects/<MyProjectFolder>/site/templates/template-name.php&line=139 But when I click on the link in the Tracy panel, NetBeans doesn't open and in the browser console I get the error message: Failed to launch 'netbeans://open?file=netbeans://open?file=/Users/<MyMacOSUserName>/NetBeansProjects/<MyProjectFolder>/site/templates/template-name.php&line=139' because the scheme does not have a registered handler. There is no guide about NetBeans for Mac. Probably NetBeans and/or Mac aren't configured well. 😕
  9. In module settings of Tracy Debugger there is the field "Editor protocol handler" where you can set the Tracy Debugger::$editor variable: I done some research to set it for NetBeans, without success. What is the editor protocol handler for NetBeans (if any) and how to set it in Tracy Debugger module settings? I'm using Apache NetBeans 16 running on Mac OS Ventura 13.0. Folder of NetBeans is /Applications/NetBeans/Apache NetBeans 16.app Folder of my project files is /Users/<MyMacOSUserName>/NetBeansProjects/<MyProjectFolder>
  10. @bernhard, your code works. Is there any reason for the code to work with render() and not with include()? I would expect that it works when I render() a template that has include() functions.
  11. Hi, in a template file I successfully used $files->include(): File: /site/templates/a-template-file.php <?php namespace ProcessWire; $files->include('partials/file-name.php'); // ... This loads the /site/templates/partials/file-name.php file containing other ("nested") $files->include() statements, for instance: File: /site/templates/partials/file-name.php <?php namespace ProcessWire; $files->include('partials/other-file-name.php') // ... Now, in the template file, I would like to use $files->render() (instead of $files->include()) to retrieve output as a return value: File: /site/templates/a-template-file.php <?php namespace ProcessWire; $output = $files->render('partials/file-name.php'); // ... But, by using the render() (instead of the include()) function, I get the error message coming from within the rendered /site/templates/partials/file-name.php file: I think the problem is the "./" as shown in the above error message. Note: In the rendered /site/templates/partials/file-name.php file, I tried to use the "nested" $files->include() with the allowedPaths option set (i.e. $files->include('partials/other-file-name.php', [], ['allowedPaths' => [$config->urls->templates]])) and many other things, without success. How can I solve the problem in order to use the render() (instead of the include()) function?
  12. @Richard Jedlička, thanks for the module. I've a feature or improvement request: to show the helper-shortcut links to fields that have visibility option set to "Open + Cannot be closed" (currently links are not shown for fields having this settings).
  13. I tried to state the namespace ProcessWire at the top of the Hanna code without success. I've to state the inline \ProcessWire\ namespace to make it work. 🤷🏻‍♂️ It would be great if someone explains why this happens. 😃
  14. Solution found using \ProcessWire\ namespace: \ProcessWire\wireSetting('a_key') Maybe there is something better...
  15. Hi, in the /site/init.php file I've stated: wireSetting([ 'a_key' => [ 'value1', 'value2', 'valueN' ], '...' => '...' ]) I normally use with success the wireSetting in my template files like this: wireSetting('a_key'). I would like to use this wireSetting in an Hanna code, but when I do this I get the error "Method ProcessWire::wireSetting does not exist or is not callable in this context". How can I use wireSetting in Hanna code?
  16. The problem here is that I've set up various Hanna code tags and, since I'm going to create many new ones increasing their number, the list of code tags in the PW admin backend (Admin > Setup > Hanna Code) will be a mess e.g. it'll be hard to find one Hanna code among the many created ones. A solution to this problem could be to name Hanna code tags with a criterion, but what is a good practice for naming them? How do you keep organized/ordered your Hanna code tags in the PW admin backend?
  17. @adrian, you are rigth. My Hanna PHP code was wrong (I was using $sanitizer->selectorValue() instead of $sanitizer->pagePathName()). Sorry for my mistake, and thanks again for the module. 💪
  18. @adrian, thanks for updating the module to v0.1.8, which I installed in ProcessWire 3.0.210. I'm using Hanna Code v0.3.2 and Hanna Code Text Formatter v0.3.2 (the latter with module settings Open Tag set to [[ and Close Tag set to ]]). Given in the field description and/or notes I use a hanna code such as [[my-hanna-code-tag attribute1="Some value" attribute2="Some other value"]], when I access the PW Admin > Edit Page (page where that field is used) then I get the error: "Unknown Selector operator: '[empty]' -- was your selector value properly escaped? In /wire/core/Selectors.php line 222". 😳 Note: the error doesn't occur when using hanna code such as [[my-hanna-code-tag]].
  19. @bernhard So, the advice is not to use conditional hooks if not as made in @ryan's example(s)?
  20. Hi @adrian, maybe I've a problem some way related to the one of @xportde. I just installed DynamicDescriptionNotes 0.1.6 in ProcessWire 3.0.200. In DDN module settings I tried both options: "Allow HTML" checked and unchecked. If "Allow HTML" is unchecked then Markdown is "translated to HTML" but output is raw HTML. If "Allow HTML" is checked then Markdown output is raw. I set "Notes" and "Description" (field settings in template context) as follows: Some **Markdown** text `code` [link](/path/to/a/page/). - [page.parent.url] - [page.title] - Test link to [Edit Parent](./?id=[page.parent.id]) What could be the problem?
  21. By using ['noHooks' => true] I still run into trouble.. and the hook runs between 3-8000+ times (var_dump, log, etc.)! wire()->addHookAfter("User::changed(user_bookmarks)", function(HookEvent $event) { // ... // here something that handles the following hook creation or updating and that avoids running into infinite loop // ... wire()->addHookAfter("Pages::savedPageOrField($user)", function(HookEvent $event) use($user, $old, $new) { // here something that save $user // $user->save() or $user->setAndSave() with $options ['noHooks' => true] // ... $event->removeHook(null); Do you mean to use the savedPageOrField() hook "standalone"? Or "nested" within another hook as in the above code?
  22. @Jan Romero I used your code and some other weird functions to come up with a solution, without success. It seems ignoring all-known-to-me $user->set('title', '...')-like functions for saving the user. User changes (except user_bookmarks) are not saved after the process ends.
  23. @Jan Romero I was too fast to say that worked for me. The log files seem gone crazy receiving many entries! ? ? Probably, it's because within the Pages::savedPageOrField($user) hook function I'm updating other $user fields, which causes the infinite loop. In fact, if I don't update the $user within savedPageOrField($user), the whole hook subtly works. I think the problem is related to the Pages::savedPageOrField($user) hook and I'm trying to limit the run of this hook by passing someway the second argument $changes... // usage with all arguments $pages->savedPageOrField(Page $page, array $changes = []); ... something like made in the official docs by using changed(0:order_status, 1:name=pending, 2:...) // ??? = what? how to state the $changes array? wire()->addHookAfter("Pages::savedPageOrField(0:$user, 1:???)", function(HookEvent $event) use($user, $old, $new) { ... and by setting limiting conditions the more classic way wire()->addHookAfter("User::changed(user_bookmarks)", function(HookEvent $event) { // ... wire()->addHookAfter("Pages::savedPageOrField($user)", function(HookEvent $event) use($user, $old, $new) { // if something, exit now ??? // ... Any help is appreciated.
  24. Thanks @Jan Romero. I'm experimenting with the savedPageOrField hook to limit it to run for user pages (because I'm working on Users), and I report this: // ready.php wire()->addHookAfter("Pages::savedPageOrField", function($event) { ... // does work wire()->addHookAfter("Page(template=user)::savedPageOrField", function($event) { ... // does not work wire()->addHookAfter("Pages(template=user)::savedPageOrField", function($event) { ... // does not work wire()->addHookAfter("User::savedPageOrField", function($event) { ... // does not work wire()->addHookAfter("Users::savedPageOrField", function($event) { ... // does not work // template.php // ... $user->setAndSave('user_bookmarks', $user_bookmarks); A say in the PW community is "users are pages too", so I expect hooks to work with Users as they work with Pages. Am I going to be victim of another of the classic blunders? ? Any help about achieving with hooks (even the savedPageOrField one) the goal to take custom actions each time the user's user_bookmarks field get updated?
  • Create New...