Jump to content

cryostar

Members
  • Posts

    26
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

cryostar's Achievements

Jr. Member

Jr. Member (3/6)

6

Reputation

  1. @alexm Thank you! This one works perfectly. ☺️
  2. 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?
  3. 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. 😊
  4. 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! 😁
  5. 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?
  6. 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?
  7. 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
  8. 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?
  9. 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.
  10. 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; });
  11. 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?
  12. 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.
  13. 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 😅)
  14. 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.
  15. 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? 😲
×
×
  • Create New...