Skip to content

Instantly share code, notes, and snippets.

@trouttdev
trouttdev / my_module.module
Created Feb 1, 2017
Reject an entire feed import if a required field in feeds_tamper fails
View my_module.module
/**
* Implements hook_feeds_after_parse().
*/
function my_module_feeds_after_parse(FeedsSource $source, FeedsParserResult $result) {
// $sql = "SELECT COUNT(*) FROM feeds_log WHERE request_time = " . REQUEST_TIME . " AND id = " . $source->id . " AND type LIKE '%feeds_tamper:required%'" ;
$number_of_prase_errors = db_select('feeds_log', 'f')
->fields('f', array('flid'))
->condition('request_time', REQUEST_TIME, '=')
@trouttdev
trouttdev / CacheResponse.php
Created Jan 11, 2017
Simple Laravel 5 response caching
View CacheResponse.php
<?php
namespace App\Http\Middleware;
use Closure;
use Cache;
class CacheResponse
{
/**
@trouttdev
trouttdev / SparkPost.md
Last active Nov 16, 2016
How to add CC and BCC fields to SparkPost API
View SparkPost.md

How to send a SparkPost email via API with a CC and BCC

Originally I found this which only vaguely pointed me in the right direction, so I thought I'd create a gist of what ended up working for me.

CC

To add a CC address, you have to two two things

  1. Add the address to your recipeints array, and set the header_to value to an address in the to field. So if you're sending the email to to_address@domain.com and CCing it to cc_address@domain.com, the header_to for cc_address@domain.com will need to be set to to_address@domain.com
  2. Add the email to the CC headers option in content object. If you have multiple emails, these should be comma separated.