Jump to content

cryostar

Members
  • Posts

    29
  • Joined

  • Last visited

Posts posted by cryostar

  1. 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.

  2. 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.

  3. 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?

  4. 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. ?

  5. 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! ?

  6. 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?

  7. 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?

  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:

    image.thumb.png.0da1f3d22eb6b2eff81d2b995495a38d.png

    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;
    });

     

    • Like 1
  11. On 6/22/2021 at 2:40 AM, Jonathan Lahijani said:

     

    I think namespacing your file with the ProcessWire namespace should fix your issue.

     

    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.

  12. 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.

    • Like 1
  13. 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.

  14. 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?

  15. 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.

  16. 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.

×
×
  • Create New...