Skip to content

Instantly share code, notes, and snippets.

Luke Stevenson lucanos

Block or report user

Report or block lucanos

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lucanos
lucanos / functions.php
Last active Aug 29, 2019 — forked from adeel-raza/functions.php
Get LearnDash next lesson link or first lesson link if course not started
View functions.php
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 / lucanos_learndash_classes.php
Created May 22, 2019
Adds Classes to Learndash Lessons and Topics based on whether the User has Completed Them or Not
View lucanos_learndash_classes.php
function lucanos_learndash_classes( $classes ) {
global $post;
if( in_array( $post->post_type , array( 'sfwd-lessons' , 'sfwd-topic' ) ) ){
$classes[] = 'learndash';
$progress = learndash_get_course_progress( null, $post->ID );
$classes[] = 'learndash-progress-'.( $progress['this']->completed != 1 ? 'in' : '' ).'complete';
}
return $classes;
}
@lucanos
lucanos / gist:c886043e8eacad6b32ca
Last active Mar 22, 2016 — forked from ebinnion/gist:2346560
Gravity Forms Pre-Submission and Notification
View gist:c886043e8eacad6b32ca
// 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 ) ,
You can’t perform that action at this time.