• Content Count

  • Joined

  • Last visited

Community Reputation

27 Excellent

About Tyssen

  • Rank
    Distinguished Member

Contact Methods

  • Website URL

Profile Information

  • Gender
  • Location
    Brisbane, Australia

Recent Profile Visitors

4,316 profile views
  1. Right, changing it to $month = date('m') seems to have fixed it.
  2. I have three events all in October and I want my events page to list events under the month of their date field. But with the below code I get two under September and one under October. The date field values for the three events is: 2018-10-13 00:00:00 2018-10-20 00:00:00 2018-10-27 00:00:00 What am I doing wrong? function childrenInMonth($page, $month, $field = 'event_date') { $startTime = $month; $endTime = strtotime("next month", $startTime); return $page->children("$field>=$startTime, $field<$endTime, sort=$field"); } $events = ''; $start = $month = strtotime('today'); $end = strtotime('+1 year'); while($month < $end) : $event_pages = childrenInMonth($page, $month); if(count($event_pages)>0) : $events .='<h2>'. date('F', $month).'</h2> <ul>'; foreach ($event_pages as $event) : $events .= ' <li> <h3>'.$event->title.'</h3> </li> '; endforeach; $events .= '</ul>'; endif; $month = strtotime("+1 month", $month); endwhile;
  3. I'm getting the following error on a production site: I don't get the error on my local version of the site. Why does it happen in production and not local? I guess it would be solved by PW not adding anything from the vendor folder to cache/FileCompiler, so how do I stop that? Or is there something else I should be doing to fix it?
  4. Tyssen

    How would you go about adding markup to an action outside a form field? For instance for an action I'm working on which sends emails, I'd like to be able to provide a button to preview the email in a modal window. Would it be with addHookAfter and if so, would I be targetting the action's class::method or the module's?
  5. I'm customising one of the actions that comes with the Admin Actions module and would like it to display a repeater matrix field. I've created a field in PW then gone to Export and copied the output and then pasted it into my action converting it from JSON to PHP format, so this is what I have: array( 'name' => 'emailBody', 'label' => 'Email body', 'description' => '', 'type' => 'repeaterMatrix', 'matrix1_name' => 'page', 'matrix1_label' => 'Choose existing page', 'matrix1_head' => '{matrix_label} [• {matrix_summary}]', 'matrix1_sort' => 1, 'matrix2_name' => 'text', 'matrix2_label' => 'Text', 'matrix2_head' => '{matrix_label} [• {matrix_summary}]', 'matrix2_sort' => 2, 'matrix1_fields' => array(2), 'matrix2_fields' => array(76), 'repeaterFields' => '', 'repeaterLoading' => 1, 'rememberOpen' => null, 'repeaterMinItems' => 1, 'matrixN_head' => '{matrix_label} [• {matrix_summary}]', 'columnWidth' => 100 ) When I load the action page I get: from FieldtypeRepeater/InputfieldRepeater.module at line 216 I haven't done anything with PW admin pages or modules before so I'm not really sure what I'm doing or whether this is the right approach. I'm posting in a separate thread rather than the official support thread as what I'm having trouble with has more to do with my understanding of how the PW API works in admin pages than with the actual module itself. cc @adrian
  6. Tyssen

    I actually want a Repeater Matrix field, not PageTable. I'm trying to implement this now and have created a field in PW then gone to Export and copied the output and then pasted it into my action converting it from JSON to PHP format. Is that the right way to go about it? Or can I point the field in the action to an already existing field? Will I be able to use any fieldtype in an action?
  7. Tyssen

    All good now, thanks. I've got quite a bit more I want to do with this action like be able to use a PageTable field to be able to compose emails from a mix of existing pages and typed content, preview the email before sending, attach files uploaded to pages, and log email sends, but I think I'm probably better creating a new thread for that as it won't really be specific to your module, but more my limited coding abilities and inexperience working with the API.
  8. Tyssen

    If you pasted the code I posted above into an action to test, it's probably because I removed all the bits I didn't change to make it shorter and easier to read. I added comments where I'd taken stuff out. So testAddress, email, body, etc. all exist in my version of the action. I had missed one $options['fromEmail'] which I've now changed to $options['from'] but other than I'm not getting any other errors. I've attached the action file if it helps. EmailBatcherCoordinator.action.php
  9. Tyssen

    I've got Tracy installed. Which tab are you seeing that error on? I'm seeing several relating to FileCompiler but they're not restricted to Admin Actions and one from Mailgun because the to parameter is incorrect.
  10. Tyssen

    I've decided to just use a select fieldtype for choosing the pages and pass in some options so that it starts from a certain parent (using pageListSelect means showing the whole tree which is overkill). But I'm having trouble with the sending of emails. This is what I have so far: <?php class EmailBatcherCoordinator extends ProcessAdminActions { protected function defineOptions() { $pagesOptions = array(); foreach($this->wire('pages')->get(3767)->children() as $age) $pagesOptions[$age->id] = $age->name; return array( array( 'name' => 'from', 'label' => 'Who is sending', 'description' => '', 'notes' => '', 'type' => 'email', 'type' => 'select', 'options' => array( 'user1@email.com'=>'User 1', 'user2@email.com'=>'User 2', ), ), array( 'name' => 'pages', 'label' => 'Pages', 'description' => 'Select the parent of pages that contain the recipients\' email addresses.', 'notes' => '', 'type' => 'select', 'options' => $pagesOptions, 'columnWidth' => 50, ), // All the other options are the same ); } protected function executeAction($options) { if($options['testAddress']) $testAddress = $options['testAddress']; $recipients = $this->wire('pages')->find($options['pages'])->children(); $emailField = $options['email']; print_r($recipients); $i = 1; foreach($recipients as $recipient) { if(isset($testAddress)) { // if a test email, then only send first match from selected Pages or Users Roles if(isset($testAddress) && $i > 1) break; $toEmail = $testAddress; } else { $toEmail = isset($emailField) ? $recipient->$emailField : $recipient; } print_r($toEmail); //replace curly braces codes with matching PW field names $htmlBody = $options['body']; $htmlBody = $this->parseBody($htmlBody, $options['fromEmail'], $recipient); $sent = $this->sendNewUserEmail($toEmail, $options['from'], $options['from'], $options['subject'], $htmlBody); if($sent) { $this->successMessage = $i . ' email successfully sent.'; } else { $this->failureMessage = 'Sorry, no emails could be sent.'; } $i++; } return true; } // Everything else is the same } So essentially all I've done so far is change how the $recipients are selected and change the from values in sendNewUserEmail to come from a dropdown rather than text inputs. Everything else is the same. When I print $recipients, it shows the correct child pages but $toEmail prints as NULL and no email gets sent and the success message is The Email Batcher action was completed successfully instead of X emails sent.
  11. Tyssen

    Yes, thanks very much.
  12. Tyssen

    Turns out the module hadn't actually been updated and was still running the old version even though I ran the update from the admin, saw that the version number had changed to 2.0.5. So not sure what happened there, but it's all good now.
  13. Tyssen

    That's where I'm going wrong then. I'm choosing the parent page and assuming that it was going to work in the same way as it does when using selector, i.e. selecting all the parent's children. Not sure why it shows the email field though as there is no email field attached to the parent's template. The reason I want to use pageListSelect is because even though this module is aimed at site admins, I'm hoping I can use the Batch Emailer at least for users with restricted access so that they can batch send emails to people assigned to pages that they can manage, and a pageListSelect is going to be more user-friendly for the less tech-savvy than them trying to work out what the page ID is etc.
  14. Tyssen

    Sorry, whenever I've posted similar questions on other forums, I've always been told to not hijack threads and to start new ones.
  15. Tyssen

    So something somewhere is not right. I'm running PW 3.0.62 with Profields Table 0.1.9 and your module 2.0.5 on a server running PHP 7. I've looked in the logs and nothing showing up there. What else should I be looking for?