cryostar
Members-
Posts
29 -
Joined
-
Last visited
Everything posted by cryostar
-
I just came across this module and I'm just curious how do we send the unsubscribe group ID for this one? Generally, the approach is to add it in the JSON: { asm: { group_id: <the unsubscribe group ID> } } but I checked the modules and there's setCustomArgs, setSection, and I don't know which of these I should put this parameter.
-
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.
-
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?
-
InputFieldCheckboxes cannot be set to required
cryostar replied to cryostar's topic in General Support
@alexm Thank you! This one works perfectly. ☺️ -
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?
-
ProcessPageLister - Viewing selected bookmark
cryostar replied to cryostar's topic in General Support
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. ? -
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! ?
-
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?
-
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?
-
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
-
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?
-
Removing the title field? And proper use of pages?
cryostar replied to Goca's topic in General Support
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. -
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; });
-
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?
-
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.
-
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 ?)
-
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.
- 1 reply
-
- 1
-
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? ?
-
How to group filtered grandchild pages by parent title?
cryostar replied to 101Bram's topic in Getting Started
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. -
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.
-
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?
-
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.
-
I’ve taken your word for it and purchased ProFields for this project. To also show my support for the future of ProcessWire. ?
-
The answer is to use repeater fields instead, right? ?
-
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.