Skip to content

Instantly share code, notes, and snippets.

View cojennin's full-sized avatar

Connor Jennings cojennin

View GitHub Profile
@cojennin
cojennin / client-sunrise.php
Created March 30, 2020 14:03
Example client-runrise.php file for filtering New Relic transactions
<?php
// Only using server var to preg match.
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
// phpcs:disable WordPress.VIP.SuperGlobalInputUsage.AccessDetected
// phpcs:disable WordPress.VIP.ValidatedSanitizedInput.InputNotSanitized
// phpcs:disable WordPress.VIP.ValidatedSanitizedInput.InputNotValidated
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotValidated
$url = $_SERVER['REQUEST_URI'];
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
@cojennin
cojennin / quiz-chain.json
Created August 26, 2016 15:20
Quiz chain!
[
{
"chain": "rio-olympics-quiz-2016",
"values": [
{
"title": "QUIZ: Rio Olympics 2016",
"notificationTemplate": {
"body": "Is your knowledge of the 2016 Olympic Games worthy of a gold, silver or bronze medal? Take our quiz and find out.",
"tag": "rio-olympics-quiz-2016",
"icon": "https://www.gdnmobilelab.com/images/olympics/rio-flag.png",
@cojennin
cojennin / post-type-any.php
Created July 12, 2016 15:58
Make post type 'any'
<?php
/**
* Plugin Name: Edit Flow - All post types in Story Budget
*/
function post_type_as_any( $args ) {
$args['post_type'] = 'any';
return $args;
}
[
{
"command": "update"
}
]
@cojennin
cojennin / guardian-mobile-lab-notification-payload.json
Created June 20, 2016 14:51
Guardian Mobile Lab Notification Payload
[
{
"command": "notification.show",
"options": {
"title": "May jobs report: Good news & bad ",
"options": {
"body": "The US economy added only 38,000 jobs this month. \n\nTAP below to explore the good news and the bad news. ",
"icon": "https://www.gdnmobilelab.com/images/mobilelab-logo-thick.png",
"tag": "jobs-report",
"data": {
<?php
/**
* Plugin Name: Edit Flow - Hide User On Calendar & Budget
*/
class EF_HideUserCalendarBudget {
/**
* @var EF_HideUserCalendarBudget
**/
private static $instance = null;
<?php
/**
* Plugin Name: Edit Flow - Allow Contributors to edit Notifications
*/
function ef_allow_contributors_to_manage_notifications() {
global $wp_roles;
$role = 'contributor';
$cap = 'edit_post_subscriptions';
<?php
/**
* Plugin Name: Edit Flow - User Group's For All
*/
function ef_show_all_users () {
return array(
'fields' => array(
'ID',
'display_name',
'user_email'
<?php
/**
* Plugin Name: Edit Flow - Autosubscribe Usergroup
*/
function efx_auto_subscribe_usergroup( $new_status, $old_status, $post ) {
global $edit_flow;
// When the post is first created, you might want to automatically set
// all of the user's user groups as following the post
if ( 'pending' == $new_status ) {
@cojennin
cojennin / notify-on-attachment.php
Last active May 6, 2016 18:49
notify-on-attachment
<?php
/**
* Plugin Name: Edit Flow - Attachment Upload Notifier
*/
function send_notification_on_upload( $id ) {
global $edit_flow;
if ( $edit_flow->helpers->module_enabled( 'notifications' )
&& $edit_flow->helpers->module_enabled('user_groups') ) {