Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by cryostar

  1. The only link-related fields I see are Page References and URL. Although none of these two fields support for having a custom text inside the anchor tag, so what I did was to create to fields - a 'link' URL field and a 'link_title' text field. This sound counterintuitive so I would like to know if there are some good solutions out there.
  2. So I have this weird request from the client that she wants to hide some statuses in the settings - hidden, locked, unique because it will be confusing to her editors and some of these settings are too powerful for them too. Is there a way to hide these?
  3. @alexm Thank you! This one works perfectly. ☺️
  4. I used the LoginRegister module for my members' portal, and part of the registration form is a field called "Where did you hear about us?" which is an InputFieldCheckboxes field. I don't want to set this as required on the user template because that would also be required for staff users as well. So I set up a hook before "LoginRegister::renderRegisterForm" to set it to required. $form->getChildByName('register_referralmode')->attr('required','required'); It works for other fields that I set to required in this approach, but this field in particular is not applying that attribute. Any thoughts on what could be the issue here?
  5. By “uses” I meant on my custom admin page I have an ___execute() method which gets the ProcessPageLister and renders it. My problem is I cannot seem to view the bookmark because the path is not recognized by my admin page (it directs me to /my-custom-admin-page/sometokenstringherefromlister). I’m not sure how extending the lister would help in my custom admin page on recognizing a random string as its path. Thank you for the help still, though. 😊
  6. I have a custom admin page which uses a ProcessPageLister module. I was already able to enable adding and modifying bookmarks by creating an ___executeEditBookmark() function on my admin module. The only thing left is to view said bookmark in the same Lister. What I noticed is that the "View" link contains an additional path which appears to be the token for said bookmark (so it's /my-admin-module/somerandomtokenstring). How do I catch this one? When I click on the View link it shows an "unrecognized path" error. Thank you for the help! 😁
  7. Hi all, I used LoginRegister for my front-end authentication and I noticed that when you type in an invalid password on the profile form, the form can still be submitted thus saving my password. Here’s my repro steps: 1. Go to LoginRegister profile form 2. Type in an invalid password (like ‘b’) 3. Submit I have enabled to include the current password on my profile form but that didn’t perform any validation. Has anyone experienced this as well?
  8. I was creating a session redirect for unauthorized visits. if(!$user->isLoggedin()) $session->redirect('/members/login?redirectUrl='.$page->path(), false); but what happens is that this query string is not present when it redirects to "members/login". Additionally, since I was using LoginRegister (not Pro) for front-end logins, I have a separate profile page but the module requires that "profile=1" is appended in the query string. So I placed it in the anchor tag. <a href="/members/profile?profile=1">Profile</a> but the same happened - the query string is removed. But when I click on the "Edit Profile" button of LoginRegister the query string is preserved. What could be the cause of this?
  9. The answer lies in my ___execute method in my module file. I should return the lister only if it's an AJAX request. So I was able to do it with: if($this->config->ajax) return $lister->execute(); return array( 'table'=>$lister->execute() ); under ___execute
  10. I created a PW module for a new admin page and I have set some buttons and a lister in an execute.php file: <div> <a class="ui-button" href="./upload-batch-record">Upload batch</a> <a class="ui-button" href="./export-filtered">Export filtered result</a> <a class="ui-button" href="./generate-template">Generate CSV Template</a> <a class="ui-button" href="<?= $addUrl ?>">Add New</a> </div> <hr class="uk-divider-small" /> <?= $table ?> Though to my surprise, Lister is also generating these buttons on top of the table like this: What can I do to prevent this?
  11. Your question regarding titles is a common question, actually. About your structure, I’m keen on advising against creating the questions as individual pages, I would rather you purchase ProFields and use a Table field instead - ProFields might even solve the problems you’ll have in the future. Not only will you have an ease in development, you’ll also support ProcessWire since this is an open source project and it relies on these paid modules for funding.
  12. Thanks @BillH! Using hooks is actually on top of my head though I was just wondering if there are other straightforward solutions that don't require code. If anyone has a requirement like I do that should make certain fields read-only when they are populated, here's how I did it (saved under ready.php): $wire->addHookBefore('Page::loaded', function(HookEvent $event){ $_page = $event->object; if($this->page->process !== 'ProcessPageEdit') return; //Run only if you're on the admin page editor if('specifictemplate' != $_page->template) return; //If only you want to lock it for certain fields if(!$_page->thatfield) return; //This is a Page Reference that returns false if there is no value $thatfield = $_page->getField('thatfield'); $thatfield->collapsed = Inputfield::collapsedNoLocked; });
  13. Is it possible to lock a field on the Edit page once it's been populated? If not, how do I prevent users from editing a field further?
  14. I did what you said but seems like it didn’t work. Do I have to put it in a class for it to work? Currently it’s all a list of functions so I’m not sure if namespacing works on these kinds.
  15. Thank you all for helping me understand this. I thought that when I echoed an object it returns the object type. I got confused why it returned a string 😂. (I'm just a returning PHP programmer, so please bear with me 😅)
  16. Out of the box, ProcessWire’s “Add Page” functionality is a two-step process: 1. Specify a page title 2. Populate the page Although there are use cases where you wish you don’t have to direct your content editors to specify a title. So it would be great if we can have some settings in the template where we can set a default title and name “on create” and expose OOTB page properties as tokens like %id%, %createdDate%, and so on.
  17. I created a "/utils/helpers.php" file to store all reusable functions and "include()" it on "ready.php" which works fine and all, but I cannot access the ProcessWire API variables. What's the best practices for these kinds of functions? 😲
  18. So assuming you selected the subchildren using “->find()”, to render the structure you want you have to iterate the result of the “subchildren” selection and use “subchild->parents()”. Check the docs here: https://processwire.com/api/ref/page/parents/ though to make sure that parent 2’s subchildren will be under the same node I don’t think there’s a straight answer to it and you may have to build the logic for that.
  19. I got it! I need to use `get` instead of `find` for single pages. That's why I couldn't access it! Odd though, I set "findOne=true" in the options parameter as well... I was hoping that it would return a Page object when I set it.
  20. When I read the docs it says that the return type of the find method is a PageArray object. echo $pages->find("template=category, categorycode=ABCD12345"); //returns 1064 However, when I checked it's returning an ID. Which explains why I cannot retrieve the page's fields either by `->get('field')` or `->field`. Am I missing something or was I looking at a different API?
  21. Hello! I created an admin page that allows a batch record insert/update via uploading a csv file. I was able to read the file using the following: protected function ___processUploadBatchRecord(InputfieldForm $form) { //called from an admin page ___executeUploadRecords $form->processInput($this->input->post); $pageFile = $form->get('order_record')->value; $destPath = $form->get('order_record')->destinationPath; $file = fopen($destPath.$pageFile,"r"); $headers = fgetcsv($file, 0, ','); $orders = array(); while ($row = fgetcsv($file, 0, ',')){ $orders[] = array_combine($headers, $row); } //TODO: Create a new page to store these values } The problem is processInput is storing the csv file in the system, which I don't want because it's a file that should be discarded after reading through it. Is this correct? I was thinking of accessing $_FILE variable but I don't know if that's a good practice in processwire.
  22. I’ve taken your word for it and purchased ProFields for this project. To also show my support for the future of ProcessWire. 😁
  23. The answer is to use repeater fields instead, right? 😅
  24. Hello everyone, You know those enumerated list when checking your stuff? 1/21 10:45, parcel at sorting hub 1/22 07:50, parcel is out for delivery What would be a good approach for this use case? I was thinking of adding children pages of shipping history under an order page but I’m not sure if that’s the way to go.
  25. Thank you! I should really get myself to familiarize with hooks 😅
  • Create New...