Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/02/2019 in all areas

  1. Tis the season to clean out the mechanical keyboard (first time in 7 years)...
    8 points
  2. Hey @ryan Just wanted to bring this to your attention: https://github.com/marketplace/actions/todo-actions Turn TODO comments inside source code into GitHub issues and closes them when they are gone.
    7 points
  3. I have to admit that it doesn't look that bad for 7 years without a proper cleaning. I'm quite impressed actually. There is only dust and one bit of whatever... maybe paper. That's not a coder keyboard. Never! Where are all the chips bits, spilled soda and coffee stains and whatsoever? ?
    5 points
  4. In those times when I was still smoking and rolling myself I had to vacuum my keyboard twice a day! Insane! This way the keyboard lastet 8 to 12 months. No longer. Full ashtray and tobacco crumbs all over the place, and the coffee! THE COFFEE! The diabolical mix of the three elements locked up CTRL and SHIFT first and then the TAB key. Haha... I wish I had photos of that scenery, I would have won this content! For sure!
    4 points
  5. Shouldn't the manufacturer name be FILTHCO?
    4 points
  6. You have 99029007164861804075467152545817733490901658221144924830052805546998766658416222832141441073883538492653516385977292093222882134415149891584000000000000000000000000 possibilities to put the keys back... ?
    4 points
  7. Hi @alanxptm, this is already there in the edit screen for roles. See the screenshot. You need to tip the checkbox and are done.
    3 points
  8. 3 points
  9. Hello. I'd somewhat rewritten WireMailMailgun a while back, to implement some more features and implement PW coding guidelines etc. My version has been somewhat in limbo, although there's been various discussions in the thread linked above. I've decided to release my version as a separate module called WireMailgun, as it has breaking changes and a slightly different implementation. I've also got it using the email validation v4 endpoint. For simple usage, either module will do what you need it to do. If you need to do some more advanced things e.g inline images or adding data, this module will help you with that. Here's the readme... WireMail Mailgun Extends WireMail to use the Mailgun API for sending emails. Installation Download the zip file at Github or clone the repo into your site/modules directory. If you downloaded the zip file, extract it in your sites/modules directory. In your admin, go to Modules > Refresh, then Modules > New, then click on the Install button for this module. API Prior to using this module, you must set up a domain in your Mailgun account to create an API key. Add the API key and domain to the module's settings. Usage Usage is similar to the basic WireMail implementation, although a few extra options are available. Please refer to the WireMail documentation for full instructions on using WireMail, and to the examples below. Extra Methods The following are extra methods implemented by this module: Chainable The following methods can be used in a chained statement: cc(string|array|null $email) - Set a "cc" email address. Only used when $batchMode is set to false. Please refer to WireMail::to() for more information on how to use this method. bcc(string|array|null $email) - Set a "bcc" email address. Only used when $batchMode is set to false. Please refer to WireMail::to() for more information on how to use this method. addData(string $key, string $value) - Add custom data to the email. See https://documentation.mailgun.com/en/latest/user_manual.html#attaching-data-to-messages for more information. addInlineImage(string $file, string $filename) - Add an inline image for referencing in HTML. Reference using "cid:" e.g. <img src='cid:filename.ext'> Requires curl_file_create() (PHP >= 5.5.0) See https://documentation.mailgun.com/en/latest/user_manual.html#sending-inline-images for more information. addRecipientVariables(array $recipients) - Add recipient variables. $recipients should be an array of data, keyed by the recipient email address See https://documentation.mailgun.com/en/latest/user_manual.html#batch-sending for more information. addTag(string $tag) - Add a tag to the email. Only ASCII allowed Maximum length of 128 characters There is a maximum number of 3 tags allowed per email. addTags(array $tags) - Add tags in a batch. setApiKey(string $apiKey) - Override the Mailgun API Key module setting. setBatchMode(bool $batchMode) - Enables or disables batch mode. This is off by default, meaning that a single email is sent with each recipient seeing the other recipients If this is on, any email addresses set by cc() and bcc() will be ignored Mailgun has a maximum hard limit of recipients allowed per batch of 1,000. Read more about batch sending. setDeliveryTime(int $time) - The (unix)time the email should be scheduled for. setDomainName(string $domain) - Override the "Domain Name" module setting. setRegion(string $region) - Override the "Region" module setting. Valid regions are "us" and "eu" Fails silently if an invalid region is passed setSender(string $domain, string $key) - Set a different API sender than the default. The third argument is $region which is optional A shortcut for calling setDomainName(), setApiKey() and setRegion() setTestMode(bool $testMode) - Override the "Test Mode" module setting. setTrackOpens(bool $trackOpens) - Override "Track Message Opens" module setting on a per-email basis. Open tracking only works for emails with bodyHTML() set setTrackClicks(bool $trackClicks) - Override "Track Message Clicks" module setting on a per-email basis. Click tracking only works for emails with bodyHTML() set Other send() - Send the email. Returns a positive number (indicating number of emails sent) or 0 on failure. validateEmail(string $email) - Validates a single address using Mailgun's address validation service. Returns an associative array. To return the response as an object, set the second argument to false For more information on what this method returns, see Mailgun's documentation. getHttpCode() - Get the API HTTP response code. A response code of 200 indicates a successful response Examples Basic Example Send an email: $mg = $mail->new(); $sent = $mg->to("user@domain.com") ->from("you@company.com") ->subject("Message Subject") ->body("Message Body") ->send(); Advanced Example Send an email using all supported WireMail methods and extra methods implemented by WireMailgun: $mg = $mail->new(); // WireMail methods $mg->to([ "user@domain.com" => "A User", "user2@domain.com" => "Another User", ]) ->from("you@company.com", "Company Name") ->replyTo("reply@company.com", "Company Name") ->subject("Message Subject") ->bodyHTML("<p>Message Body</p>") // A text version will be automatically created ->header("key1", "value1") ->headers(["key2" => "value2"]) ->attachment("/path/to/file.ext", "filename.ext"); // WireMailgun methods $mg->cc("cc@domain.com") ->bcc(["bcc@domain.com", "bcc2@domain.com"]) ->addData("key", "value") // Custom X-Mailgun-Variables data ->addInlineImage("/path/to/file-inline.jpg", "filename-inline.jpg") // Add inline image ->addTag("tag1") // Add a single tag ->addTags(["tag2", "tag3"]) // Add tags in a batch ->setBatchMode(false) // A single email will be sent, both "to" recipients shown ->setDeliveryTime(time() + 3600) // The email will be delivered in an hour ->setSender($domain, $key, "eu") // Use a different domain to send, this one in the EU region ->setTestMode(true) // Mailgun won't actually send the email ->setTrackOpens(false) // Disable tracking opens ->setTrackClicks(false); // Disable tracking clicks // Batch mode is set to false, so 1 returned if successful $numSent = $mg->send(); echo "The email was " . ($numSent ? "" : "not ") . "sent."; Validate an Email Address $mg = $mail->new(); $response = $mg->validateEmail("user@domain.com", false); if($mg->getHttpCode() == 200) { echo $response->result == "deliverable" ? "Valid" : "Not valid"; } else { echo "Could not validate"; } I hope it is useful! Cheers, Chris
    2 points
  10. https://vanillajstoolkit.com/ is another good location to look for VanillaJS
    2 points
  11. Checkout You Might Not Need jQuery for this, it will tell you some replacements for the most common jQuery operations! Here's a rough draft: function more(url) { window.location = url; } document.querySelectorAll('a').forEach( link => link.addEventListener('click', e => { e.preventDefault(); const href = e.currentTarget.href; document.body.classList.add('fade-out'); setTimeout(() => more(href), 500); }); ); Note that the callback to fadeOut in your code is "open" while the reload function is called "more", is that a mistake? Anyway, I corrected it. Note you have to add a CSS transition for the "fade-out" class yourself, check the link above for an easy example. Also make sure that the timeout (500ms in my example) matches the duration of the CSS transition. Cheers! Sidenote, if all you're doing is delaying the page reload by a couple hundred miliseconds to have the body fadeout, you might as well get rid of that, it only gets in the way of the user without any real benefit. But I don't know anything about your use-case, so I might be way off here!
    2 points
  12. RockAwesome ProcessWire Fieldtype to easily choose FontAwesome Icons Usage Install the module. Set paths in the Inputfield's settings page. Add a RockAwesome field to any template (or change an existing TEXT field). Preview https://modules.processwire.com/modules/fieldtype-rock-awesome/ https://github.com/BernhardBaumrock/RockAwesome
    1 point
  13. This week we’ll take a quick break from core updates and have a look at a new module called UserActivity, just added to the ProcessWire ProDevTools package— https://processwire.com/blog/posts/user-activity-module/
    1 point
  14. Hi @adrian, Ah bugger, I'll see if I can figure that out... As I understand it, WireMail calls should always use to() to set the recipients. However, it does make sense to allow for recipients to be set from addRecipientVariables(), as this prevents repetition should you want to set custom variables (id and name are the ones inferred from the "to" recipients). Hopefully this example makes some sense of that: $to = array(); $recipientsArr = array(); foreach($recipients as $u) { if($u->$email) { $name = $u->first_name . ' ' . $u->last_name; $to[$u->email] = $name; /* If addRecipientVariables() isn't used, the recipient variable is inferred as: $recipientsArr[$u->$email] = array( 'id' => $i++, // index increment (%recipient.id% in bodyHTML) 'name' => $name, // (%recipient.name% in bodyHTML) ); */ $recipientsArr[$u->$email] = array( 'id' => $u->id, 'toName' => $name, // (%recipient.toName% in bodyHTML) ); } } // Previous usage $mailer = $mail->new(); $mailer->setBatchMode(true); $mailer->to($to); $mailer->addRecipientVariables($recipientsArr); $mailer->from('me@google.com', 'My Name'); $mailer->subject($newsletter->title); $mailer->bodyHTML($message); $numSent = $mailer->send(); // Now simplified, no need for to() $mailer = $mail->new(); $mailer->setBatchMode(true); $mailer->addRecipientVariables($recipientsArr); $mailer->from('me@google.com', 'My Name'); $mailer->subject($newsletter->title); $mailer->bodyHTML($message); $numSent = $mailer->send(); // After the next update, records in $recipientsArr above must contain a value for either "name" or "toName" // for this to be set as the "to" recipient name, e.g. $mailer->to($email, $name); Some more info about toName: $mail["toName"] is set by the core WireMail.php to() function as seen in the example in my previous post. The reason I pull the recipient emails from $mail["toName"] is that this array is a key=>value store of email addresses and the name set for them (if set), whereas $mail["to"] just contains the email addresses. In WireMail::send(), $mail["to"] is traversed and the name is set if it exists in $mail["toName"]: // WireMail.php 611-619 foreach($this->to as $to) { $toName = isset($this->mail['toName'][$to]) ? $this->mail['toName'][$to] : ''; if($toName) $to = $this->bundleEmailAndName($to, $toName); // bundle to "User Name <user@example.com>" if($param) { if(@mail($to, $subject, $body, $header, $param)) $numSent++; } else { if(@mail($to, $subject, $body, $header)) $numSent++; } } I suspect this is probably a result of an earlier implementation of WireMail that didn't have the toName option - I think it makes more sense to traverse $mail["toName"] in this module's implementation. The WireMail::toName() method isn't actually used by this module directly - in core WireMail this sets the "name" for the last added "to" email address, so could be used like so: $mg = $mail->new(); $mg->to("email@example.com") ->toName("An Example Name") ->subject("A Subject") ->bodyHTML("<p>Test</p>") ->send(); // Sends to "An Example Name <email@example.com>" // An alternative to $mg->to("email@example.com", "An Example Name"); On another note, while reviewing the docs I see there's a line length limit on X-Mailgun-Recipient-Variables which I'll likely need to handle too. Will see what I can do with this. Cheers, Chris
    1 point
  15. No, but I posted a hook for using the hidden JS max filesize validation for File fields: I'm not sure if this validation is used for Image fields. Another hook that could be used to check the filesize after an image is uploaded: $wire->addHookBefore('InputfieldImage::fileAdded', function(HookEvent $event) { /* @var Pageimage $image */ $image = $event->arguments(0); $max_filesize = 150000; if($image->filesize > $max_filesize) { throw new WireException("Image $image->basename is $image->filesize bytes which exceeds the maximum of $max_filesize bytes."); } });
    1 point
  16. The link I've been needing all my life thanks!
    1 point
  17. I guess so. \ comes from your Windows install... Try to clear compiled files under modules (bottom of page).
    1 point
  18. Hi @adrian, Got a chance to look at this today. Batch requests (batch mode on, to emails > 1000) now get split up into separate API requests with 1000 emails per request. The only way I could test this was to reduce the limit to 2 and then try sending a batch request to more than two email addresses. Seems to work fine, however I'd recommend enabling test mode and testing with this to confirm that it works correctly for emails being sent to 1000+ users prior to sending for real. I've also moved the batchMode setting into the module config, so it can be set to ON by default. Cheers, Chris
    1 point
  19. @lemgrago I think at the moment the module only supports a single depth of grouping. I did a quick check and it doesn't work for me either. If it helps you can always declare your routes like: 'firstlevel/secondlevel' => [ ['GET', 'endpoint', Example::class, 'test'], ], 'firstlevel/another-secondlevel' => [ ['GET', 'endpoint', Example::class, 'test'], ], I might add multiple nested groups in the future
    1 point
  20. Hi @adrian, I did look at using the SDK for the module, but felt it was overkill for what was required - A more fully featured Mailgun API module could be built with it, but that's a job for someone with more experience and need for it. I'll have a look at this in the next week though. Not sure I'll be able to test it fully, but it should just be a case of splitting the to array into batches of 1000 and sending each of these. Cheers, Chris
    1 point
  21. @charger So the bug you're facing is due to the fact that repeaters are pages under the hood and the module checks permission those pages as well and since you do not have view access enabled for your repeater template the values return empty. So in version 1.0.5 you just need to enable view access for your repeater template repeater_product_groups and the values should show up. But since you are already enabling view for your repeater field I think it's safe to assume that you want to enable view for template that used by that repeater field too. So for latest version 1.0.6 that I just released you don't have to enable access to your repeater templates. Just enabling access to your repeater field is enough. New Version 1.0.6 Just upgrade the module to the version above and let me know if it solves your problem.
    1 point
  22. Hello @horst This looks very interesting. Is it available in the module directory? Couldn't find it. I'm currently looking into setting up a site profile that follows atomic design principles. Part of which would be asset management/compilation.
    1 point
  23. The guilty party is a rule in the middle of layout.less in the custom/theme/components folder.
    1 point
  24. I had a play around and this hook seems to do the job: Edit: the hook doesn't work because the selected pages are lost on page save. Maybe related to the discussion in this issue. $wire->addHookBefore('InputfieldPage::render', function(HookEvent $event) { /* @var InputfieldPage $inputfield */ $inputfield = $event->object; $page = $inputfield->hasPage; $field = $inputfield->hasField; // Return early if inputfield is not in a Repeater page if(!$page instanceof RepeaterPage) return; $selector = $inputfield->findPagesSelector; // Return early if no selector or selector doesn't include a dependency if(!$selector || strpos($selector, '=page.') === false) return; // Get suffix added to inputfields in this Repeater page $suffix = str_replace($field->name, '', $inputfield->name); // Add the suffix to dependency inputfield names $selector = preg_replace('/(=page.[_a-zA-Z0-9]+)/', "$1{$suffix}", $selector); // Replace the original findPagesSelector $inputfield->findPagesSelector = $selector; }); Demo... Page tree: Selector string for Subcategory field: Page Edit:
    1 point
  25. You can do this with the undocumented dependent selects feature, which AJAX loads the selectable pages in a Page Reference field based on the value of another Page Reference field in the same page being edited. Your "homes_in_neighborhood" field would use this as the "Selector string" setting: neighborhood=page.neighborhood, neighborhood!='' You can limit by template, parent, etc too if you want. Based on my previous experience: Both Page Reference fields must use a Select, Select Multiple or AsmSelect inputfield. Dependent selects do not work inside Repeater fields. When changing the "source" Page Reference field you sometimes randomly get an option preselected in the "target" Page Reference field. Not a major problem but just something to keep an eye on to avoid accidentally saving an unintended value. If these limitations are a problem and you don't mind having to save the page after changing the "neighborhood" field then you can use the "Custom PHP code" option for selectable pages instead.
    1 point
  26. Why no prefix? I would rather use the Pager with a blank PageArray and trick it a little. Configure your prefix to use something unique like "toreplaceprefix". Set your template to allow page numbers AND url segments. Then do something like this: $limit = 2; $start = $input->urlSegment1 ? ($input->urlSegment1 - 1) * $limit : 0; $pageNum = $input->urlSegment1 ? : 1; // page number for pager $pa = $pages->find("template=basic-page, start=$start, limit=$limit"); foreach($pa as $p){ $content .= "<p>$p->title</p>"; } $pagination = new PageArray(); $pagination->setTotal($pa->getTotal()); $pagination->setLimit($limit); $pagination->setStart($pageNum); $pagerHTML = $pagination->renderPager(array( "baseUrl" => $page->url, )); $pagerHTML = str_replace("toreplaceprefix", "", $pagerHTML); $content .= $pagerHTML;
    1 point
  27. @Joss, so far I know that css code is injected inline in the output of the embed tag if you checked the responsive option in the TextformatterVideoEmbed settings.
    1 point
×
×
  • Create New...