Skip to content

Instantly share code, notes, and snippets.

View kjohnson's full-sized avatar

Kyle B. Johnson kjohnson

View GitHub Profile
@kjohnson
kjohnson / pdf.php
Created March 12, 2015 14:48
Repeatable Logo for Ninja Forms PDF Submissions
<?php
/**
* PDF Submission with repeatable Logo
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
?>
<html>
<head>
@kjohnson
kjohnson / attachment.php
Created March 12, 2015 17:30
Attach Email to Ninja Forms Notifications
public function my_custom_add_attachment( $attachments, $id ) {
global $ninja_forms_processing;
// Get our submission ID
$sub_id = $ninja_forms_processing->get_form_setting( 'sub_id' );
// convert submission id to array
$sub_ids = array( $sub_id );
// File to Attach
@kjohnson
kjohnson / current-date-short-code.php
Created March 13, 2015 15:36
Current Date Short Code
<?php
/*
* Plugin Name: Current Date Short Code
*/
function current_date_short_code_func($args) {
if ( ! isset( $args['format'] ) )
{
$args['format'] = 'm/d/Y';
@kjohnson
kjohnson / ninja-forms-add-email-attachment.php
Created March 13, 2015 15:37
Add an Attachment to Email Notifications in Ninja Forms
<?php
/*
Plugin Name: Ninja Forms Email Attachment
*/
function add_my_attachment( $attachments ) {
$attachments[] = 'server_path_to_my_file';
return $attachments;
}
@kjohnson
kjohnson / ninja-forms-scroll-to-first-error.php
Last active June 25, 2020 09:14
Scroll to the First Error on a Ninja Forms form
<?php
/**
* Plugin Name: Ninja Forms - Scroll to First Error
* Author: Kyle B. Johnson
* Description: Scroll to First Error
* Version: 0.0.1
*/
function ninja_forms_scroll_js() {
global $ninja_forms_processing;
@kjohnson
kjohnson / ninja-forms-file-uploads-help.txt
Created March 13, 2015 18:31
File Renaming Help Tab Text for Ninja Forms File Uploads
If you leave the advanced rename box empty, the uploaded file will retain the original user's filename. (With any special characters removed.)
If you want to rename the file, however, you can. These are the conventions that Ninja Forms understands, and their effect.
%filename% - The file's original filename, with any special characters removed.
%formtitle% - The title of the current form, with any special characters removed.
%username% - The WordPress username for the user, if they are logged in.
%userid% - The WordPress ID (int) for the user, if they are logged in.
%displayname% - The WordPress displayname for the user, if they are logged in.
%lastname% - The WordPress lastname for the user, if they are logged in.
%firstname% - The WordPress firstname for the user, if they are logged in.
<?php
/**
* Plugin Name: Ninja Forms JS Debug
*/
define("NINJA_FORMS_JS_DEBUG", true);
a:4:{s:4:"data";a:7:{s:12:"date_updated";s:19:"2015-03-17 19:56:34";s:14:"clear_complete";s:1:"1";s:13:"hide_complete";s:1:"1";s:10:"show_title";s:1:"0";s:6:"status";s:0:"";s:10:"form_title";s:21:"Auto-Total Issue Test";s:8:"last_sub";s:1:"2";}s:2:"id";N;s:5:"field";a:9:{i:0;a:7:{s:2:"id";s:4:"2769";s:7:"form_id";s:3:"249";s:4:"type";s:7:"_number";s:5:"order";s:1:"0";s:4:"data";a:17:{s:5:"label";s:6:"Number";s:15:"input_limit_msg";s:17:"character(s) left";s:9:"label_pos";s:5:"above";s:13:"default_value";s:0:"";s:10:"number_min";s:0:"";s:10:"number_max";s:0:"";s:11:"number_step";s:0:"";s:3:"req";s:1:"0";s:17:"calc_auto_include";s:1:"0";s:8:"num_sort";s:1:"0";s:11:"admin_label";s:0:"";s:5:"class";s:0:"";s:9:"show_help";s:1:"0";s:9:"help_text";s:0:"";s:9:"show_desc";s:1:"0";s:8:"desc_pos";s:4:"none";s:9:"desc_text";s:0:"";}s:6:"fav_id";N;s:6:"def_id";N;}i:1;a:7:{s:2:"id";s:4:"2770";s:7:"form_id";s:3:"249";s:4:"type";s:5:"_calc";s:5:"order";s:1:"1";s:4:"data";a:23:{s:5:"label";s:11:"Calculation";s:15:"input_limit
function get_ninja_forms_version() {
$plugin_settings = get_option( 'ninja_forms_settings' );
return isset( $plugin_settings['version'] ) ? $plugin_settings['version'] : '';
}
@kjohnson
kjohnson / nf-datepicker-localize-de.js
Created March 19, 2015 19:05
Ninja Forms Datepicker Localization German
jQuery(document).ready( function() {
jQuery.datepicker.setDefaults(
{
prevText: '&#x3c;zurück', prevStatus: '',
prevJumpText: '&#x3c;&#x3c;', prevJumpStatus: '',
nextText: 'Vor&#x3e;', nextStatus: '',
nextJumpText: '&#x3e;&#x3e;', nextJumpStatus: '',
currentText: 'heute', currentStatus: '',
todayText: 'heute', todayStatus: '',
clearText: '-', clearStatus: '',