Skip to content

Instantly share code, notes, and snippets.

@dtbaker
dtbaker / invoice_task_list.php
Created March 28, 2015 11:12
Regex the UCM task list before external/PDF generation
<?php
<?php
/*
* Upload this file to a new folder called:
* /custom/includes/plugin_invoice/template/invoice_task_list.php
* This file will get included instead of the default invoice_task_list.php file
* This file gets the default invoice task list generated HTML content and performs a regex on it
* Useful for some minor task list modifications without editing the entire task list file.
@dtbaker
dtbaker / envato.lib.php
Created May 26, 2015 10:19
Envato PHP library by @sowailem
<?php
/**
* @file
* Integration layer to communicate with the Envato API.
*
* @see https://build.envato.com/api
*
* @outher Abdullah Sowailem.
*/
@dtbaker
dtbaker / test_api.php
Created May 26, 2015 10:28
test envato api oauth for UBLThemes
<?php
ini_set('display_errors',true);
ini_set('error_reporting',E_ALL);;
$clientid = 'XXXXXXXXXXXXXXXXXXX';
$fields_string = '';
$errors = array();
@dtbaker
dtbaker / functions.php
Last active August 29, 2015 14:23
Code snippet to get bbPress talking with Support Hub correctly
// this code does two things:
// 1) sets the 'support_hub' return parameter to the xmlrpc getUser request. In here we can include additional options to display within Support Hub when replying to a bbPress post. Currently we have 'Mark Thread as Resolved' as an option. This option gets passed back to bbPress via XMLRPC when replying to a post from Support Hub, so we can action this.
// 2) a hook for xmlrpc insert post to detect if we're posting a forum thread. This runs the standard bbPress update hooks to ensure all the bbPress meta values are updated correctly after posting a reply. We also look for any custom options (e.g. mark as resolved) and perform actions based on those as well.
// UPDATE: instead of adding this code, try using this bbPress Support plugin: https://github.com/dtbaker/bbPress-Support-Forums it does everything (making threads as resolved, feature voting, etc..)
// this is for SupportHub to operate correctly, passing the envato_codes as a meta key along with user requests.
//apply_f
@dtbaker
dtbaker / vc_update.php
Created September 17, 2015 01:20
Server side Visual Composer update script
<?php
/**
* Visual Composer Extended License Updater
* Server Side Update Script
* Author: dtbaker
* Details: http://dtbaker.net/web-development/visual-composer-plugin-updates-in-3rd-party-themes/
*
* Upload this script to your website (e.g. yourwebsite.com/vc_update.php)
* Adjust the API key to your own
* Add the other code into your WordPress theme
@dtbaker
dtbaker / vc_theme.php
Created September 17, 2015 02:08
Visual Composer update script for including in 3rd party themes
<?php
/**
* Visual Composer Update script for 3rd party Themes
* Details here: http://dtbaker.net/web-development/visual-composer-plugin-updates-in-3rd-party-themes/
* Author: dtbaker
*
*/
// ************* CHANGE ME *************** change me to your server side visual composer update URL
@dtbaker
dtbaker / class.envato-api-basic.php
Last active December 21, 2020 06:15
Simple PHP class for interacting with the Envato API within a WordPress plugin
<?php
/**
* Exception handling class.
*/
class EnvatoException extends Exception {
}
@dtbaker
dtbaker / class.envato2.php
Created October 9, 2015 02:57
Using the verify-purchase endpoint of the new Envato API to validate a purchase code.
<?php
// NOTE: verify-purchase has been deprecated and it's best to use the new /author/sale endpoint as documented on http://build.envato.com/
// created by Envato user wpdreams https://forums.envato.com/t/verify-purchase-class/3526
// usage example:
$o = EnvatoApi2::verifyPurchase( $purchase_code );
@dtbaker
dtbaker / ucm-customer-import.php
Created October 17, 2015 22:30
Example import a customer into UCM
<?php
$customer_import = array(
'customer_name' => 'Test Customer Import',
'customer_extra' => array(
'Extra Key 1' => 'Extra Val 1',
'Extra Key 2' => 'Extra Val 2',
'Extra Key 3' => 'Extra Val 3',
),
'address' => array(
@dtbaker
dtbaker / custom_link.php
Created November 25, 2015 00:50
Create custom links in the UCM menu