Skip to content

Instantly share code, notes, and snippets.

View mikeyhoward1977's full-sized avatar
🏠
Working from home

Mike Howard mikeyhoward1977

🏠
Working from home
View GitHub Profile
<?php
$args = array (
'method' => 'POST',
'body' => array (
'epd_first_name' => 'Joe',
'epd_last_name' => 'Blogs',
'epd_email' => 'someone@email.com',
'demo_ref' => '310a345749514f0412adabwxfe6ee7f4',
'remote_phrase' => '91f6fd676fcc6ba2b537ac278ecc83da',
@mikeyhoward1977
mikeyhoward1977 / epd-example-rest-response.json
Last active November 17, 2020 16:41
Example Easy Plugin Demo REST Request
{
"admin_url": "https://myawesomesite.com/someoneemailcom/wp-admin/",
"code": "epd_demo_created",
"demo": "EPD",
"expires": "2020/11/17 5:08 pm",
"first_name": "Joe",
"home_url": "https://myawesomesite.com/someoneemailcom",
"ID": 444,
"last_name": "Blogs",
"requires_activation": false,
@mikeyhoward1977
mikeyhoward1977 / eps-custom-registration-form-heading.php
Last active August 18, 2020 21:05
Customise the heading text on the EPD registration form
/**
* Replace heading on the demo registration form.
*
* @param string $heading Heading for registration form
* @return string Heading for registration form
*/
function custom_epd_set_demo_heading_for_registration( $heading ) {
$heading = __( 'Register for my Cool Demo' );
return $heading;
@mikeyhoward1977
mikeyhoward1977 / epd-hide-registration-form-fields.php
Last active August 11, 2020 15:25
This code snippet enables the hiding of input fields on the Easy Plugin Demo registration form
<?php
/**
* Remove registration fields from required fields list.
*
* @param array $fields Array of required field names
* @return array Array of required field names
*/
function custom_epd_remove_required_fields( $fields ) {
// Uncomment the array values you want to remove from the required fields list
@mikeyhoward1977
mikeyhoward1977 / redirect-agent-login.php
Last active October 31, 2018 09:17
Redirect agents to ticket admin when they login via the Ticket Manager front end
<?php
/**
* Redirect agents to the ticket admin screen.
*
* Effective when agents login via the KBS front end login form.
*
* @param string $redirect_to The redirect URL
* @param int $user_id ID of user logging in
* @return string Redirect URL
@mikeyhoward1977
mikeyhoward1977 / epd-welcome-panel.php
Last active August 20, 2018 19:06
Example welcome panel from Easy Plugin Demo
<style>
.welcome-panel .welcome-register:before { content: "\f481"; }
.welcome-panel .welcome-themes:before { content: "\f100"; }
.welcome-panel .welcome-plugins:before { content: "\f106"; top: -3px; }
.welcome-panel .welcome-docs:before { content: "\f118"; top: -2px; }
.welcome-panel .welcome-rate:before { content: "\f155"; top: -2px; }
.welcome-panel .welcome-support:before { content: "\f125"; top: -2px; }
</style>
<h2><?php _e( 'Welcome to the {demo_product_name} (EPD) Demo!', 'easy-plugin-demo' ); ?></h2>
@mikeyhoward1977
mikeyhoward1977 / kbs-update-orphaned-ticket-status.php
Last active June 13, 2018 08:25
KB Support: Search for tickets with an orphaned status and update
<?php
/**
* Find tickets that are set to a status that is no longer registered
* and update their status to the value of the $new_status variable.
*
* @written by Mike Howard
* @for KB Support - https://wordpress.org/plugins/kb-support
*/
function kbs_update_orphaned_ticket_status() {
global $wpdb;
<?php
/**
* Runs during admin_init hook to determine if our plugin has been upgraded.
*
* Determine if any processes need to be executed and call them as required.
*
* - Replace 'mp_plugin_version' with the option name used to store your plugin version in the DB
* - Replace 'mp_plugin_version_upgraded_from' with the option name you want to use to store the version upgraded from
* - Replace 'MP_PLUGIN_VERSION' with the constant you use to store your plugin version
*/
@mikeyhoward1977
mikeyhoward1977 / mikes-plugins-wordpress-boilerplate.php
Last active April 23, 2018 16:07
WordPress Plugin Boilerplate
<?php
/**
* Plugin Name: Mikes Plugin Boilerplate
* Plugin URI: https://mikesplugins.co.uk
* Description: A basic boilerplate for writing WordPress plugins
* Version: 1.0
* Date: 23 April 2018
* Author: Mike Howard
* Author URI: https://mikesplugins.co.uk/
* Text Domain: mikes-plugins
@mikeyhoward1977
mikeyhoward1977 / mp-plugin-upgrade-basic.php
Last active April 23, 2018 16:11
WordPress Plugin Upgrade (Basic)
<?php
/**
* Runs during admin_init hook to determine if our plugin has been upgraded.
*
* Determine if any processes need to be executed and call them as required.
*
* - Replace 'mp_plugin_version' with the option name used to store your plugin version in the DB
* - Replace 'mp_plugin_version_upgraded_from' with the option name you want to use to store the version upgraded from
* - Replace 'MP_PLUGIN_VERSION' with the constant you use to store your plugin version
*/