Skip to content

Instantly share code, notes, and snippets.

@WebBaker
WebBaker / Hide EB Profile Fields.php
Created February 4, 2013 21:48
Can be inserted inside your theme's functions.php file to conditionally hide Eventbrite Tickets user profile fields for users who do not need that functionality.
/**
* Hides the Eventbrite Tickets fields from user profiles, unless the user is on the exception
* list.
*/
class EventbriteProfileFieldsHider {
protected $exceptionList = array(1);
/**
* Any users who still need to see the Eventbrite Tickets fields in their profile should be
@WebBaker
WebBaker / gist:4471412
Created January 7, 2013 00:55
Enqueuing only on the TECCC options page
<?php
add_action('admin_enqueue_scripts', 'our_enqueue_action', 10, 1);
function our_enqueue_action($hook) {
// Are we somewhere in the Tribe admin pages?
if ($hook !== 'tribe_events_page_tribe-events-calendar') return;
// Is this the category colors page?
if (!isset($_GET['tab']) or $_GET['tab'] !== 'category-colors') return;
@WebBaker
WebBaker / gist:4120141
Created November 20, 2012 18:54
Actions and Objects in an 8-bit container
class ActionValue {
const OBJECT_VAL = 0;
const ACTION_VAL = 1;
const NAME = 0;
const DATA = 1;
const MASK = 240; // 11110000
protected $actions = array(
'session' => array(0, array(
'started' => 0,
@WebBaker
WebBaker / gist:4118303
Created November 20, 2012 14:37
Adjust posts_per_page value for Tribe Events Taxonomy requests
/**
* Sets the number of posts to display on Events taxonomy pages to the value of
* EVENT_CATEGORY_POST_LIMIT (if not defined, this will be defined as 10 by
* default).
*
* @param WP_Query $query
*/
function changeEventCategoryPostsPerPage($query) {
defined('EVENT_CATEGORY_POST_LIMIT') or define('EVENT_CATEGORY_POST_LIMIT', 10);
@WebBaker
WebBaker / fb-adjustment-tec.php
Created November 10, 2012 17:28
Enforced Facebook Time Adjustment (Importing into The Events Calendar)
/**
* Automates the process of correcting times imported from Facebook by a fixed
* number of hours (plus or minus).
*
* @uses DateTime which introduces a requirement for PHP 5.2 or greater
*/
class FBEventsTimeCorrection {
protected $negative = false;
protected $hours = 0;
protected $modifier = '';