Jump to content

Juergen

Members
  • Posts

    1,424
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Juergen

  1. Conclusion: It is not possible to hook a class that is not loaded directly on a page. In my case, the Label class is loaded and used indirectly within the form, as it is used within the inputfield class and not directly in the form class. The form class is loaded directly onto the page and can be hooked - the Label class is not.
  2. Hello @PWaddict I have adapted the hook to change the form markup inside the readme file to get it working now. The previous versions of hooks did not work, because the hooks will never be triggered. Instead you have to hook "Form::render" and change the markup there. Here you can see the example of the readme file to change the markup of the asterisk on required fields. Before: After: Hope this helps
  3. Hello @Frank Vèssia I have taken a look at this issue and I will not change the "untitled-xxxx" to something else, because this username is absolutely unique. If you want to prevent, such random usernames to be stored inside the database, then please go to the module configuration and go to the tab for the registration form. There please add the field "Username" to the registration form (and to the profile form as well if you want). This forces the user to enter a username during the registration process and you will not get the randomly created "untitled-xxxx". Best regards
  4. Hello @Frank Vèssia The untitled-xxxxx as name will be added by default if you choose login with email and password and not with username and password. BTW the random username can be overwritten by the user itself if he wants. So there is no need for the user to accept this random username. I know this is not a really nice random username, but using the email address instead is not a good idea, because if you want to output the username on the frontend, everyone can see the email address. I guess the "untitled" will be added by PW if nothing is entered in the name field and the number will be appended by a hook as I can remember, but I have to take a look (I do not remember exactly). The untitled-xxxx will be added by PW and makes the name absolutely unique. I will think over if there will be simple solution to change the name to a more nicer one 😉
  5. Hello @Andy Take a look at the custom rules. There are some ready-to-use validators which check against the database (fe. uniqueEmail to check if email is not registered inside the user table). List of Custom rules If you want to check against custom tables, you have to check it inside the isValid() method by your own. There is no possibility to create and add custom rules by yourself. if ($form->isValid()) { //make your custom check here (fe checking a form value against the database) if(customcheck is valid){ // go on with your code } else { // set an error message at the top of the form $alert = $form->getAlert(); $alert->setErrorMessage('Sorry, but there are errors inside the form'); // set an error message on the inputfield itself (fe. an email input) $emailInput = $form->getFormElementByName('email); $emailInput->setErrorMessage('There is an error'); } } I have not tested the code above, but you got the idea such an issue could be solved. The last option is to write an request on Github for a new validator and if it could be useful for others I will try to implement it 😉 Best regards
  6. Thanks for your quick response @bernhard I compared your example to mine and I see that you are calling the method ($foo->hello()) inside your ready() method. In this case it works on my side too, but this is not the scenario that I want. I want to manipulate the output not inside the ready() but before page render, so the markup of the method should be changed before the page will be rendered. public function ___renderAsterisk(): string { return '<span class="asterisk">*</span>'; } This is a render function, which will be called during the render function of the form and the form will be rendered during the page will be rendered. So I want to change the output of the renderAsterisk() method inside the site/init.php and this does not work at all. wire()->addHookAfter('Label::renderAsterisk', function ($event) { $event->return = ' - hooked aha :)'; }); So this works fine if the renderAsterisk() method will be called inside the ready.php separately. $foo = new Label(); bd($foo->renderAsterisk()); But it does not work if the renderAsterisk() method is included inside another render function (in this case inside the render function of the form. This should be the issue of the problem. To simplify: It works if the renderAsterisk() method will be called directly, but not if this method is included within another method and will be called there.
  7. Hello @bernhard This is interesting, but in my case the hook does not get fired. It seems that that it will be ignored. The function is hookable by prefixing 3 underscores: public function ___renderAsterisk(): string { return '<span class="asterisk">*</span>'; } The class 'Label' itself (where the function above is part of) is derived from the Wire class (take a look here on the top parent class), so hooks must be implemented and should work. Only to mention: the top parent class called 'Tag' is an abstract class - could this have an impact on the issue? Do you have a working example in one of your numerous modules, where you use a hook inside the init.php to hook a method in one of your modules?
  8. Hello @PWaddict I guess this is a namespace related problem, but I have not found a solution to this issue. Therefore I have written a blog post in the forum in the hope others could help. Best regards
  9. Hello @all I have tried to apply a hook to a class of a module of my mine which runs inside a namespace. The hook is included inside the site/init.php. $this->wire()->addHookAfter('Label::renderAsterisk', function(HookEvent $event) { bd('render Asterisk'); }); This hook runs on the function renderAsterisk() which is hookable and part of the class "Label" (original File: Label.php). This class descends from Wire so hooks should work inside this class, but I guess the main problem is that this class runs inside its own namespace called "FrontendForms". So I tried different versions within the hook to define the class: FrontendForms\Label::renderAsterisk \FrontendForms\Label::renderAsterisk \\FrontendForms\Label::renderAsterisk FrontendForms\\Label::renderAsterisk None of the versions above work! After a search on the internet, I found a discussion about this problem here. It seems that other people have also stumbled upon this problem. My question: Has anyone already struggled with the same problem and found a solution on how to get hooks to work on classes with namespaces, or could there be another cause responsible for this behavior? Additional info: This issue comes from my FrontendForms module and I've used hooks in the past to manipulate the output a bit (look here). The hooks have worked in the past, but it seems that they don't work anymore in PW version 3. Thanks for your help!
  10. Hello @PWaddict I can remember that someone has posted the same problem in the past. I will take a look at this issue tomorrow, but as I can remember the Hook problem was a PW problem and not a FrontendForms problem. Please be patient! I will try to trace the problem to its source Best regards
  11. Hello @MarkE Thank you for reporting this issue on sites with many pages (and providing a solution). My websites don't have many pages, so I've never encountered such an issue. 😉 I've integrated your fix into the latest version (1.3.15), so the issue should be fixed by now. According to your suggestion to make the "move" of a child page optional, I will take a look at it in the near future. Thanks Jürgen
  12. FrontendLoginRegister module is updated now (Version 1.3.6) The following last 2 issues have been fixed now: Support for usage of multilanguage fields inside user template added New configuration field to make the "Request deletion of user account page" public viewable added Screenshot of the new configuration field to change the access of the user account deletion page: In the middle you can see the "Allow public deletion of a user account" checkbox. If you check this checkbox, the deletion page will be public reachable. For more information check the changelog.md. Please keep in mind! This module is Beta stage, so it is not recommended to update live sites without testing it locally before! I have tested various scenarious, but I cannot test all possible cases - so happy testing 😉 As always, please report any issues here or on GitHub.
  13. The following issues should be solved now: The position of the privacy check is now always at the bottom, regardless of the use of a CAPTCHA (bug fixed) New configuration field to select whether to use an internal or external page for the privacy policy added. This configuration supports multilingualism, which means you can select a different page for each language. These issues have been fixed in the FrontenForms module and not in the FrontendLoginRegister module. This means that you will need to update the FrontendForms module to the latest version 2.2.27 to fix these issues. The other problems (public deletion link, multilanguage user fields) directly affect the FrontendLoginRegister module and must be solved there. I will try to solve these issues in the next time. You can read the full documentation of changes in the changelog.md. Hope it works now as expected without problems!!
  14. I will add an additional configuration field in the backend, where you can select if you want to use an internal page or enter the link to an external page for linking to the privacy page.
  15. Ok, I see - There is an additional check if user is guest inside the DeleteRequestPage.php on line 35 // if user is guest -> not allowed to be here -> let's redirect to the homepage $this->redirectToHomepage(true); If you comment this out, it should work. I will add a new setting in the backend config, where you can choose if the page should be public reachable or not. For now, commenting out this code line should help you.
  16. Hello @Frank Vèssia Thanks for your questions. I will try to answere them 😉 1) The translations should be still there... maybe you have not installed the files of this module??? The translations for the button texts are inside each template file for each page of the module. Take a look here: The files are for example for the DeleteAccountPage.php, DeleteRequestPage.php and so on. This files include the texts for the submit buttons. If these translation files are not present inside your installation, then you have not installed it. To install it, please click on the "Find files to translate" button and select all files of this module. Afterwards the translation files must be visible inside the language files. 2) This should not happen. I will check this if no Captcha is enabled. Link to an external page is a good idea for a feature request. I will add this feature to the module in the future. 🙂 At the moment it is not possible. 3) Only fields that can be edited by the user will be displayed in the select. If you do not have enabled it inside the user template, the custom user fields will not be displayed. So please check if you have toggled the checkbox next to the field inside the user template. In this example I have added the field "Age", which is an integer field. As you can see the custom field age is checked and now it can be selected inside the select too. 4) You can make the page public by changing the visibility inside the template for the deletion link. The templates name is "fl_deleterequestpage". So please go to "templates" select the template with the name ""fl_deleterequestpage" and change the access level to public by checking "guest" instead of "registered". Hope this helps!!
  17. Version 2.2.21 comes with an UI upgrade! The new version has no additional new features, but a UI upgrade for better userfriendly selection of the global email template. As you can see, the old select input field has been replaced by a stylish image picker select. Now you can see how the template looks like. This is realized via a Jquery image picker script and thumbnails of each template. The templates you will see above are the default email templates shipped with this module. If you have created your own custom template, you can also display it here. You will find more information inside the changelog file.
  18. Version 1.3.6 comes with 2 new features: New configuration field to limit the filesize of uploaded files globally Save mails as pages too (user request by @Flashmaster82 in the forum here You can read more about the new features here in the changelogs. Please test it carefully before using it on live sites and have fun! 🙂
  19. Hello @bernhard I have tested your module and it works very well!! Unfortunately it does not exactly what I want, because it imports json files. What I need is to get all language files of a module as csv, not json. The reason for this is that the language files of a module should be shipped as csv files inside the languages folder, so they could be imported by the user. So I am looking for an easy to use solution to get all all language files of a module as csv files. Then I use the command line interface to copy all these files into one. At the moment PW only supports the download of each csv file separately, which is very time-consuming. It would be great if there would be a possibiltiy to select if the language files should be imported as json or csv. This is only an idea for a request - I know you are very busy and if you do not agree with me, it is ok. Wish you nice weekend and thank you for all your work you have done till now for the community! Best regards Jürgen
  20. Hello @DrewPH I have added your request to the new version 2.2.18. Now you can find a new text field inside the module configuration under the AJAX tab, where you can change the info text for the user during an AJAX request. If you enter a custom text into this field, then this text will be displayed globally on each form on the site. In addition I have added a new method too, where you can change the text on per form base, which means that you can use a different text on each form (if needed). I guess this is a use case, that will not be needed very often, but if so.....you can. This new method is called setAjaxMessage() and has to be used with the form object: $form->setAjaxMessage('This is my custom submission text'); This method overwrites the default or global text on per form base. BTW, I have discovered 2 other JavaScript problems beside the problem you have described during the development of this new feature and I have fixed these problems too. You will find the complete description of all changes inside the changelog of this version. As always, please keep an eye if everything works as expected after the update!! Best regards Jürgen
  21. Hello @DrewPH Thanks for you issue report and your suggestion for a new feature!! I have fixed the JS error. Please replace the JS file with the new one on GitHub (https://github.com/juergenweb/FrontendForms/blob/main/frontendforms.js) and let me know if the error is gone now. Your suggestion to be able to customize the info message during an Ajax request: I will take a look to add a new configuration field in the backend to change the message text to your needs. BTW, it is not really hard coded - it is a translatable string, so you can change it in the backend to your needs if you have the language option installed in PW. But I will take a look to make it possible to change it independently. Best regards Jürgen
  22. Hello @DrewPH Thanks for reporting this issue and you are absolutely right. I have changed all class names (not only the "block" class name) of the CAPTCHA element by adding the prefix "ffm" to all classes. Now it should be very unlikely to get class names conflicts in the future. So please update to the latest version 2.2.17 in order to get all changes. You can read the full changelog here. Important information to all other users: If you have modified the styling of the Slider Captcha by adding your own CSS by overwriting the default CSS, please take care that the class names have been changed now and your changes will no longer affect the the styling of the CAPTCHA. So please adapt your custom CSS with the new class names.
  23. Thank you @bernhard for your work!!!! This sounds very useful and I will try it out in the next time.
  24. Thanks for reporting this issue!! 😃 I have fixed this bug yesterday, but I have not bumped up the module version, because I am optimizing the code at the moment. So please replace the current file on Github with yours and everything should be fine. Best regards
×
×
  • Create New...