Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / 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 / custom_table_hooks.php
Last active January 2, 2016 22:53
Modify columns from the UCM table output (i.e. remove columns from Customer table)
<?php
// This example removes the "Customer" and "Group" and "Staff" columns from the main customer page.
// It also adds some new columns to the "Customer" and "Job" listing tables.
// Upload this file to includes/plugin_custom_table_hooks/custom_table_hooks.php in the UCM folder
class module_custom_table_hooks extends module_base{
public function init(){
@dtbaker
dtbaker / custom_dashboard_widgets.php
Created January 20, 2015 23:46
This is an example of how to add widgets to the UCM dashboard
<?php
// upload this file to includes/plugin_custom_dashboard_widgets/custom_dashboard_widgets.php
class module_custom_dashboard_widgets extends module_base{
public static function can_i($actions,$name=false,$category=false,$module=false){
if(!$module)$module=__CLASS__;
return parent::can_i($actions,$name,$category,$module);
}
@dtbaker
dtbaker / custom_table_hooks.php
Last active August 29, 2015 14:13
Add this to UCM in includes/plugin_custom_table_hooks/custom_table_hooks.php
<?php
class module_custom_table_hooks extends module_base{
public function init(){
hook_add('table_process_data','module_custom_table_hooks::hook_table_process_data');
}
public static function hook_table_process_data($callback, $table_manager){