Jump to content

LAPS

Members
  • Posts

    258
  • Joined

  • Last visited

Everything posted by LAPS

  1. Hi, I've successfully installed and used Language Support & Co. and Functional Fields modules so that I can translate almost all the strings of my website in English (default) and Italian. Now, in my template files I've "See also" strings that I would like to translate globally (not per template by using Functional Fields). How should I make this? I read the doc and maybe what I need is to use the textdomain, but I didn't understand how to use it. That is, what text/code should be in the file? any example? Also, in the admin area I have the menu items Default and Italian under Setup > Languages. Once accessed one of them, there is the field "Site Translation Files" with the description: "Use this field for translations specific to your site (like files in /site/templates/ for example)". Should I use this field (instead of textdomains) to set globally translated strings? If so, what text/code should be in the file? any example?
  2. By using an array to define module configuration (PW new module configuration) I partly solved the issue of configuring the Page Reference field because data is not saved: array( 'name' => 'selectedPages', 'type' => 'page', 'label' => $this->_('Selected pages'), 'description' => $this->_('Selected pages description).'), 'inputfield' => 'InputfieldCheckboxes', 'derefAsPage' => 0, 'collapsed' => 0, 'optionColumns' => 0, 'labelFieldName' => '.', 'labelFieldFormat' => '{name}', 'findPagesSelector' => 'template=named-template, include=all', 'allowUnpub' => true, 'required' => true, 'defaultValue' => 1985, 'notes' => $this->_('Selected pages notes'), // I tryed to set value to '', [] and $this->selectedPages without success 'value' => ???, ) How should I configure the page checkboxes field to store data submitted from the module page? Update: I found a possible solution here.
  3. @bernhard, thank you for remembering me to use Tracy Debugger. ? Assuming the Tracy field settings and field code panels that you mentioned are in the "Request info" tab, when I expand the "Field List & Values" link in it, then it doesn't list the Page Reference field that in my case is not working (the field shows the error message above). In fact, only 'title' and 'process' fields are shown.
  4. I'm developing a module that has a configurable Page Reference field. For this page field, I would like to set some options via API. Here are these options as they are shown in the admin area: Details > Page field value type set to "Multiple pages PageArray". Input > Selectable pages > Template set to "template-name". Input > Selectable pages > Label field set to "Custom format": "{title} {summary}". Set initial values (see below). In my module file PageSelectionModule.config.php I have: class PageSelectionModule extends ModuleConfig { public function __construct() { $this->add(array( // Page field: selectedPages // Note: By using this code, in the module page I get the error message: // "This field needs to be configured before it can be used". array( 'name' => 'selectedPages', 'type' => 'page', 'label' => $this->_('Selected pages'), 'description' => $this->_('Selected pages description).'), 'value' => ???, 'required' => true, 'notes' => $this->_('Selected pages notes'), ) )); } } My questions are: How can I set the above page field options via API in the module? Is the 'value' handled (stored and retrieved) internally by PW? Where I can find some documentation about all this?
  5. I'm using ProcessWire 3.0.98 and I'm trying to understand because the user cannot view the uploaded image in the Edit Profile page (even if the image upload seems to be successful since the related file is uploaded to the /site/assets/files folder of the website). In Edit Profile I get a "blank" image: and also in the frontend when outputting it: Update In file config.php I have set $config->pagefileSecure = true; and if I remove this then the profile image field works as expected. However I need this config enabled since I prevent access to files of access protected pages throughout all the website. Furthermore, for the user template the option "Do you want to manage view and edit access for pages using this template?" under "Advanced" tab is set to "No", so I expect the file to be accessible. However, the user template has not template file (user.php). What should I do in order to keep things consistent? BTW @Zeka, in your linked post I have not posted.
  6. Are there some updates about issues with making images to be edited by the user in their own profile (admin area)? I'm in trouble with it. What I made is: In the 'user' template, I added an 'images' field. In the 'role' page (designating users allowed to edit their profile), I checked/enabled the 'profile-edit' permission. In the 'ProcessProfile' (User Profile) module, I checked/enabled the 'images' field. What happens is: when the user goes to the page /processwire/profile/ (admin area) then the image upload seems to be successful but the user cannot view the uploaded image. Is there something I'm doing wrong?
  7. To remove the 'pass', 'email', 'roles', and 'language' fields from the user_copy template, I had to temporarily disable their "system" and "permanent" statuses for each field by unchecking the related options in the Advanced tab of Edit Field. After this, I was able to complete the step 3 successfully.
  8. When I manage to remove the 'pass', 'email', 'roles', and 'language' fields of the user_copy template and save then I get this error message: The only field I have been able to remove was the 'admin_theme'.
  9. On step 3, when I select "user" for "Fieldgroup" and save, then I get this error message:
  10. In particular, I'm developing a new module that creates a copy of the user template and keeps that copy updated as regards the fields. I think, the module needs these things: a ___install() method that creates a new custom template copying the fields (with contexts/settings) of the user template. a hook method (maybe stated in ready()) that checks if the user template has been updated and if so updates the custom template accordingly so to have the same fields in both user and custom templates. How can I make?
  11. I would like to allow logged in users to edit their profile almost the same way as they can make with other PW pages so that, once set for them proper page-edit permissions, they should be able to edit their user profile fields except for fields such as roles but including inputfield types such as repeaters and images. Since it seems that there are issues about this matter ([1], [2], [3], [4], [5], etc.) and an old solution of multiple templates for users (that could be valid still today), my current question is: how should I allow users to edit their profile? If there are any updates about this matter or insights about how to proceed, please inform me.
  12. Hello @Ivan Gretsky, I'm trying to create my first module and it would be great if you could help me in writing the code to replace unauthorised internal page links with plain text. What I did so far is: <?php namespace ProcessWire; class TextformatterObfuscateUnAuthInternalPageLinks extends Textformatter { public static function getModuleInfo() { return array( 'title' => __('Textformatter Obfuscate Unauthorised Internal Page Links', __FILE__), 'version' => 1, 'summary' => __("Replaces HTML links pointing to unauthorised internal pages with plain text", __FILE__), ); } public function format(&$content) { // search for <a> HTML tags and replace unauthorised internal page links $dom = new DOMDocument; $dom->loadHTML($content); foreach ($dom->getElementsByTagName('a') as $node) { $href = wire('sanitizer')->url($node->getAttribute('href')); $_page = wire('pages')->get("path=$href"); // if $_page exists (has been found)... if($_page->id) { // ... if user has not page-view permission for $_page if(!wire('user')->hasPermission('page-view', $_page)) { // ... transform link to plain text // (perhaps, only) here I need your help for removing/transforming the $node link... } } } } } Note: I didn't tested this code yet. ☺️
  13. In my PW website many pages are using CKEditor fields that contain links pointing to other internal pages of the website. Since some pages to which links point to are only accessible to specific user roles, I would like to not show on the front-end the "unauthorised internal page" links (<a href="..."></a>) to not authorised users but just plain text. What do you recommend to avoid outputting those "unauthorised internal page" links? Should I remove/transform such links from within the text before rendering them on the front-end by using a PW hook? If so, e.g. what hook should I use, and how to check the "unauthorised internal page" links and replace them with plain text?
  14. I'm trying for the first time the Pages2Pdf module because I would like to create a PDF from an array of custom data: $custom_data = ["paragraph1"=>"text1", "paragraph2"=>"text2", "paragraph3"=>"text3"] My (newbie) questions are: How can I build the PDF file from the above data (maybe passing the data to a Pages2Pdf template file)? Could/Should I use a template file located in the /site/templates/pages2pdf folder to make this? Bonus: To reach my intent (note: I'm not creating PDF from Page data but from e.g. FormBuilder data entry), should I install and use both Pages2Pdf and WirePDF modules or can I just install and use the WirePDF one? should I use the Pages2Pdf at all? Code examples are welcome.
  15. Hi all, in my site I would like to list the favorite pages of a logged in user (I'm using the PW LoginRegister module). To make that, I thought about adding a button on every page of the site so that the logged in user can click it (running a AJAX function) and save somehow his favorite pages (e.g. storing the pages ID to the database). My question are: what is the PW "approach" and how to make something like that?
  16. Hi @Soma, thanks for the module! See UPDATEs below. I'm using ProcessWire 3.0.98 and the CSS styling seems not to work even if the CSS classes are added to the HTML source code. That is, I get the following: However, in the module configuration page, the preview looks good: UPDATE - By inspecting the CSS code I just discovered unwanted style properties added to the page (note: the CSS that the MSSB module would add is still not loaded): I don't know why it happens and probably it's not directly related to MSSB, but it would be great if anyone can help. ? SOLVED - I just discovered I should had been including the theme.css file present in the MSSB theme folder to my site. That is, to use: <link rel="stylesheet" type="text/css" href="path/to/theme.css" /> Alternatively, I should had been adding the CSS statements in my website CSS file.
  17. @Macrura, I do not understand how to configure the assets from within my formbuilder.inc file in my templates folder and how to add a init js file that would init the inputfield. Can you provide some more detailed guidelines to use ChosenSelect in FormBuilder to use pages? BTW/Note: I'm using ProcessWire 3.0.98
  18. Thanks for the replies. @BitPoet your code works. It'd be correct if the check_access=0 handles/supports access to files too. What do you think about? Could it be an inbuilt PW feature? @ryan
  19. How can I make that (even though I think it's not the best solution since the check_access=0 should work also for accessing files ?)?
  20. @Tom. certainly! Here it is when rendering one image: somewords<br> <img src="/site/assets/files/1258/image.jpg" alt="img description"> The problem is that the image is not accessible probably because it is protected by PW even if I use check_access=0. Note: I edited the original post adding the check_access=0 in the selector for finding protected pages.
  21. @Tom. it works the same by using and not using '{' and '}' in the img tag. As you guessed, the problem still remains. Thanks anyway.
  22. I've set the template protected-pages so that only certain, non-guest user roles have access to view pages. I've also set $config->pagefileSecure = true in the config.php file so to prevents http access to file assets of access protected pages. In the protected-pages template file I use the following sample code (note use of check_access=0): $protected_pages = $pages->find("template=protected-pages, check_access=0, title~=somewords"); foreach($protected_pages as $protected_page) { echo $protected_page->title . "<br>"; echo "<img src='$protected_page->image->url' alt='$protected_page->image->description' />"; } The above code shows to guests the page title (as expected) but not the image. I would like to allow guests to access not only page titles but also image files of protected pages, and just for this occasion. Is it possible (maybe just switching pagefileSecure settings on/off at runtime)? If so, how can I make that?
  23. Hi @teppo, thank you. It works. However, I had to edit and re-save the page.
  24. Hi, I have a page for which I manage access so that guest users can not view it. This page has attached an image. Of course, the basic page access settings works as expected for guests by denying them to view the page. However, when I, as a guest user, access directly the attached image via its URL then I can view the image! How can I deny access also to the image?
  25. HI @adrian, I would like to try your PageProtector module but I have to know whether I can set the login (username-password pair) per page? If I understand it correctly, the username-password pair can be set globally and not for every single page.
×
×
  • Create New...