Skip to content

Instantly share code, notes, and snippets.

View kjohnson's full-sized avatar

Kyle B. Johnson kjohnson

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Page Name</title>
<style>
* {
@kjohnson
kjohnson / nf_post_creation_user_dropdown.php
Created August 5, 2015 19:36
Disable Post Creation User Dropdown
<?php if ( ! defined( 'ABSPATH' ) ) exit;
/*
Plugin Name: Ninja Forms - Disable Post Creation User Dropdown
Plugin URI: http://ninjaforms.com
Description: Disable Post Creation User Dropdown
Version: 0.1.0
Author: Kyle B. Johnson
Author URI: http://kylebjohnson.me
*/
<?php
/*
Plugin Name: Ninja Forms - Webhooks Auth Headers
*/
add_filter( 'nf_remote_post_args', 'nf_wh_add_auth' );
function nf_wh_add_auth( $args ){
$headers = array(
@kjohnson
kjohnson / nf_fee_do_shortcode_disable.php
Last active August 29, 2015 14:26
Disable do_shortcode for Front End Editor
<?php if ( ! defined( 'ABSPATH' ) ) exit;
/*
* Plugin Name: Ninja Forms - Front End Editor - Disable do_shortcode
* Plugin URI: http://kylebjohnson.me
* Version: 0.1.0
* Author: The WP Ninjas
*/
add_filter( 'nf_fee_do_shortcodes', 'nf_fee_do_shortcodes_disbale' );
function nf_fee_do_shortcodes_disbale( $enabled ){
@kjohnson
kjohnson / class.php
Last active September 4, 2015 13:50
Loading configuration arrays from another file
<?php
class Foo
{
protected $_settings = array();
public function __construct()
{
$this->_settings = include 'config.php';
}
<?php
add_filter( 'nf_registration_logged_in_msg', 'kbj_nf_custom_login_form_success_message' );
function kbj_nf_custom_login_form_success_message( $message ){
$message = "You are now logged in. Please <a href='#'>click here</a> to be redirected.";
return $message;
}
@kjohnson
kjohnson / single.php
Created September 22, 2015 19:12
Multi Dimensional Array to Single Deminsional Array
<?php
function multi_to_single_r( $array ){
foreach( $array as $key => $value ){
if( is_array( $value ) ){
unset( $array[ $key ] );
<?php
add_filter( 'nf_email_notification_attachments', 'my_custom_attachment', 10, 2 );
function my_custom_attachment( $attachments, $action_id ){
// Confirm the Action ID is the intended email action.
if( '1' != $action_id ) return $attachments;
// Create Attachment File Path
<?php
/*
Plugin Name: Ninja Forms - Custom Attachment Filter
*/
add_filter( 'nf_email_notification_attachments', 'my_custom_attachment', 9001, 2 );
function my_custom_attachment( $attachments, $action_id ){
public function get_user()
{
return get_user_by( 'id', $this->_user_id );
}