Skip to content

Instantly share code, notes, and snippets.

View fjarrett's full-sized avatar

Frankie Jarrett fjarrett

View GitHub Profile
@fjarrett
fjarrett / gist:1c4a5917fb180028d710
Last active August 29, 2015 14:11
Custom user registration via AJAX
<?php
/**
* Process user registration via AJAX
*
* A custom user registration process that listens for a
* specific type POST request that will create a new user
* on the blog.
*
* @action wp_ajax_nopriv_fjarrett_user_registration
@fjarrett
fjarrett / gist:4887016fd3f69463ccb5
Created December 18, 2014 02:26
Custom user registration jQuery
/* globals fjarrett */
jQuery( function( $ ) {
$( document ).on( 'click', 'form #submit-registration', function (e) {
$.ajax({
type: 'POST',
url: fjarrett.ajaxurl,
data: {
action: 'fjarrett_user_registration',
registration_token: $( '#registration_token' ).val(),
@fjarrett
fjarrett / gist:8cd04bd33e49bbd6e3b7
Last active September 19, 2015 09:04
Force WP JSON REST API endpoints to always be served over HTTPS
<?php
/**
* Force WP JSON REST API endpoints to always be served over HTTPS
*
* @action wp_json_server_before_serve
*
* @return void
*/
function fjarrett_wp_json_force_ssl() {
@fjarrett
fjarrett / gist:0fa79273bd879f7ab6b3
Last active September 3, 2021 20:19
Prevent Concurrent Logins
<?php
/**
* Detect if the current user has concurrent sessions
*
* @return bool
*/
function pcl_user_has_concurrent_sessions() {
return ( is_user_logged_in() && count( wp_get_all_sessions() ) > 1 );
}
@fjarrett
fjarrett / gist:be5423e0899895558d75
Last active August 29, 2015 14:13
Delete unwanted Stream Notification Rule post meta from other post types
<?php
function wp_stream_scrub_notification_rule_post_meta() {
$post_types = get_post_types( array(), 'names' );
unset( $post_types['stream_notification'] );
$args = array(
'post_type' => $post_types,
'post_status' => 'any',
@fjarrett
fjarrett / bio.md
Last active January 29, 2017 04:19
Frankie Jarrett's professional bio

Frankie Jarrett is a full-stack developer from St. Joseph, Missouri who has been building PHP web applications and WordPress products since 2007. He is Senior WordPress Product Engineer at GoDaddy and loves the fact that he gets to work with WordPress every single day.

From launching his own theme shop in 2011, to building large-scale enterprise websites, authoring dozens of plugins, and now creating amazing product experiences on GoDaddy's hosting platform - WordPress has always been at the center of Frankie's career, and he plans to keep it that way!

Outside of work, Frankie is the director of music and worship at his local church. He enjoys being a dad to his son, Rivers, traveling with his wife, Gracie, smoking his own BBQ and yelling at the TV during games.

@fjarrett
fjarrett / gist:1334474ad5ae7a71ad33
Created March 30, 2015 21:51
onename verification
Verifying that +fjarrett is my openname (Bitcoin username). https://onename.com/fjarrett
@fjarrett
fjarrett / gist:83c2698ea83ca7381ff8
Last active August 29, 2015 14:18
Testing the output of PHP microtime()
<?php
echo '<h1>Current Time</h1>';
$microtime = microtime( true );
printf( '<p><strong>Unix epoch microtime:</strong> %s</p>', $microtime );
printf( '<p><strong>GMT/UTC timezeone:</strong> %s</p>', date( 'Y-m-d H:i:s', $microtime ) );
@fjarrett
fjarrett / Post_Type.php
Last active August 29, 2015 14:24
Register post type helper class
<?php
///////////////////////////////////////////////////////////////////////////////////
// Please use within a namespace, or change this helper class name. //
// Don't forget to properly prefix the apply_filters() calls made throughout. //
// //
// Example usage: //
// //
// new Post_Type( 'book', 'Book', 'Books' ); //
// new Post_Type( 'video', 'Video', 'Videos', array( 'has_archive' => false ) ); //
@fjarrett
fjarrett / wp-bulk-update-plugins.sh
Last active September 12, 2015 18:51
Update all plugins on every virtual host running WordPress
#!/bin/bash
for DIR in /var/www/*/public_html; do
cd $DIR
if [ -f "wp-config.php" ]; then
echo "cd $DIR"