Skip to content

Instantly share code, notes, and snippets.

View lucanos's full-sized avatar

Luke Stevenson lucanos

View GitHub Profile
@lucanos
lucanos / CreateWordpressUser.php
Last active June 21, 2022 04:37 — forked from jawinn/CreateWordpressUser.php
Create WordPress Admin User from PHP
<?php
// ADD NEW ADMIN USER TO WORDPRESS
// ----------------------------------
// Put this file in your Wordpress root directory and run it from your browser.
$user = false;
$errors = array();
if( isset( $_POST ) ){
@lucanos
lucanos / functions.php
Last active November 30, 2022 12:00 — forked from adeel-raza/functions.php
Get LearnDash next lesson link or first lesson link if course not started
function ld_next_lesson_link( $course_id = null ) {
global $post;
$user = _wp_get_current_user();
if( is_null( $course_id ) ) {
$course_id = learndash_get_course_id( $post );
}
if( !$course_id || !isset( $user->ID ) ) {
// User Not Logged In OR No Course Identified
@lucanos
lucanos / gist:c886043e8eacad6b32ca
Last active March 22, 2016 16:35 — forked from ebinnion/gist:2346560
Gravity Forms Pre-Submission and Notification
// http://www.gravityhelp.com/forums/topic/simple-calculations
// change the 41 here to your form ID
add_action('gform_pre_submission_41', 'ch_awesomeness_rating');
function ch_awesomeness_rating($form) {
// set up one array for each step of the form
// each array contains the input IDs of the fields we want to sum on each page
// IDs do not need to be consecutive using this method
$step_groups = array(
38 => array( 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 ) ,