Tyssen

Members
  • Content count

    212
  • Joined

  • Last visited

Community Reputation

27 Excellent

About Tyssen

  • Rank
    Distinguished Member

Contact Methods

  • Website URL
    http://www.tyssendesign.com.au/

Profile Information

  • Gender
    Male
  • Location
    Brisbane, Australia

Recent Profile Visitors

4,157 profile views
  1. 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?
  2. 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
  3. 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?
  4. 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.
  5. 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
  6. 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.
  7. 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.
  8. Tyssen

    Yes, thanks very much.
  9. 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.
  10. 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.
  11. 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.
  12. 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?
  13. Tyssen

    { "draw": { "id": 146, "type": "FieldtypeTable", "flags": 0, "name": "draw", "label": "Match schedule", "maxCols": 9, "col1sort": 1, "col2sort": 2, "col3sort": 3, "col1name": "round", "col1label": "Round", "col1type": "int2", "col1width": 10, "col2name": "date", "col2label": "Date", "col2type": "date", "col2width": 10, "col3name": "game", "col3label": "Game", "col3type": "int2", "col3width": 10, "col4name": "home", "col4label": "Home", "col4type": "text", "col4sort": 4, "col5name": "away", "col5label": "Away", "col5type": "text", "col5sort": 5, "col6name": "time", "col6label": "Time", "col6type": "datetime", "col6width": 15, "col6sort": 6, "col7name": "field", "col7label": "Field", "col7type": "text", "col7width": 10, "col7sort": 7, "col2settings": "dateInputFormat=Y-m-d\ndateOutputFormat=j M\ndatepicker=3\ndefaultToday=0\nyearRange=-10:+10", "col4settings": "textformatters=\nplaceholder=\ndefault=\nmaxLength=2048\nrows=1", "col5settings": "textformatters=\nplaceholder=\ndefault=\nmaxLength=2048\nrows=1", "col6settings": "dateInputFormat=\ntimeInputFormat=h:ia\ndateOutputFormat=\ntimeOutputFormat=h:ia\ndatepicker=\ndefaultToday=0\nyearRange=-10:+10\nplaceholder=", "col7settings": "textformatters=TextformatterEntities\nplaceholder=\ndefault=\nmaxLength=2048", "allow_overwrite": null, "col8name": "marshal", "col8label": "Marshal", "col8type": "text", "col8sort": 8, "col8settings": "textformatters=TextformatterEntities\nplaceholder=\ndefault=\nmaxLength=2048", "col9name": "second", "col9label": "Second game", "col9type": "text", "col9sort": 9, "col9settings": "textformatters=TextformatterEntities\nplaceholder=\ndefault=\nmaxLength=2048", "tags": "results", "collapsed": 0, "paginationLimit": 0, "useBigDelete": null, "col1options": "", "col1selector": "", "col2options": "", "col2selector": "", "col3options": "", "col3selector": "", "col4width": "", "col4options": "", "col4selector": "", "col5width": "", "col5options": "", "col5selector": "", "col6options": "", "col6selector": "", "col7options": "", "col7selector": "", "col8width": "", "col8options": "", "col8selector": "", "col9width": "", "col9options": "", "col9selector": "", "renameColumn": "", "orderByCols": "", "addRowLabel": "", "showIf": "", "themeColor": "", "themeBorder": "", "themeOffset": "", "columnWidth": 100, "required": "", "requiredIf": "" } } Not sure whether it's relevant, but my table has a column at the end that's not included in the CSV.
  14. Tyssen

    I was using an older version of Profields table. I've updated to the latest and now it's creating the rows, but everything is coming out blank. Sample row looks like 1,21-Apr,1,"Team 1","Team 2","08:30","Field 1A" I've tried with the above and wrapping the first three columns in "" too.
  15. Tyssen

    Actually creating separate action files which have hard-coded values will probably be the easiest and quickest; didn't think of that!