Skip to content

Instantly share code, notes, and snippets.

View actual-saurabh's full-sized avatar
💭
I may be slow to respond.

Saurabh Shukla actual-saurabh

💭
I may be slow to respond.
View GitHub Profile
@actual-saurabh
actual-saurabh / llms-certificate-grade-merge-code.php
Created October 5, 2019 09:30
LifterLMS Certificate Merge Code for Grades
<?php // Do not copy this line
// Copy from under this line and paste into your child theme's functions.php
add_filter( 'llms_certificate_merge_codes', 'llms_certificate_grade_merge_code', 10, 2 );
function llms_certificate_grade_merge_code( $merge_codes_array, $certificate_object ) {
// add custom certificate title merge code to existing ones. See https://github.com/gocodebox/lifterlms/blob/a1a6833c6e6bab57bf4356739463220e51f89408/includes/certificates/class.llms.certificate.user.php#L132
@actual-saurabh
actual-saurabh / class-llms-serial-number-generator.php
Last active April 7, 2022 09:50
Serial Numbers for Transaction Receipts
<?php // Do not copy this line
// copy from below this line
/**
* Generates sequential serial numbers for a given post type
*/
class LLMS_Serial_Number_Generator {
private $post_type = '';
@actual-saurabh
actual-saurabh / llms-certificate-custom-merge-codes.php
Created April 2, 2019 15:47
LifterLMS Custom Merge Codes for Certificates
<?php // Do not copy this line
// Copy from under this line and paste into your child theme's functions.php
add_filter( 'llms_certificate_merge_codes', 'llms_custom_certificate_prefix_suffix_merge_codes', 10, 2 );
function llms_custom_certificate_title_merge_code( $merge_codes_array, $certificate_object ){
// add custom certificate title merge code to existing ones. See https://github.com/gocodebox/lifterlms/blob/a1a6833c6e6bab57bf4356739463220e51f89408/includes/certificates/class.llms.certificate.user.php#L132
$merge_codes_array['{merge-code-1}'] = get_user_meta( $certificate_object->user_id, 'custom_field_key_1', true );
@actual-saurabh
actual-saurabh / course-syllabus-collapsible-sections.css
Last active March 25, 2022 09:55
LifterLMS Collapsible Course Syllabus
.llms-syllabus-wrapper .llms-section-title {
cursor: pointer;
}
.llms-syllabus-wrapper .llms-section-title::after {
content: "\25b6";
float: left;
display: inline-block;
width: 15px;
text-align: left;
margin-right: 15px;
@actual-saurabh
actual-saurabh / lifterlms-custom-profile-fields-add.php
Last active March 30, 2020 19:05 — forked from thomasplevy/lifterlms-custom-profile-fields-add.php
Custom Fields added to LifterLMS Registration/Checkout
<?php // don't copy this line to your functions.php file
/**
*
* Create Company Industry as a custom field upon registration or checkout
*
* @param $fields - fields already being registered
* @param $screen - either checkout or registration screen
* @return $fields - array with added field
*/
function add_company_industry_lifterlms ( $fields , $screen ) {
@actual-saurabh
actual-saurabh / llms-access-plan-switch-filters.php
Created December 11, 2019 06:20
Access Plans Upgrade/Downgrade
<?php
// hide system access plans from pricing table and course/membership editor
add_filter( 'llms_get_product_access_plans_args', 'llms_custom_hide_system_access_plans_args' );
function llms_custom_hide_system_access_plans_args ( $args, $product, $free_only, $visible_only ) {
if( isset( $args['tax_query'] ) ) {
$args['tax_query'][0]['terms'][] = 'system';
<?php
/**
* Contains Navigation Action Class
*/
defined( 'ABSPATH' ) || exit;
/**
* Class for calculating navigation actions
*/
@actual-saurabh
actual-saurabh / restrospective-certificates.php
Created September 24, 2019 17:50
Award a Certificate associated with a trigger and an engagement to a user
<?php
/**
* Award a certificate engagement attached to a unit (course, quiz, etc) to a user
* @param int $user_id The ID of the user to award the certificate to.
* @param int $engagement_id The post ID of the engagement
* @param int $trigger_id The post ID of the trigger post (course, lesson, quiz, etc)
*/
function llms_award_certificate( $user_id, $engagement_id, $trigger_id ){
@actual-saurabh
actual-saurabh / llms-remove-notifications.php
Last active September 5, 2019 08:49
Remove frontend notifications from LifterLMS
<?php // Do not copy this line
// Copy from under this line and paste into your child theme's functions.php
add_action( 'init', 'llms_turn_off_notifications', 10, 999 );
add_action( 'wp_enqueue_scripts', 'llms_dequeue_notification_script', 10, 999 );
if ( ! function_exists( 'llms_turn_off_notifications' ) ){
function llms_turn_off_notifications(){
@actual-saurabh
actual-saurabh / llms-change-cols-number.php
Created July 1, 2019 16:51
Change LifterLMS registration field column class (llms-cols-6, etc)
<?php // Do not copy this line.
// Copy from under this line and paste into your child theme's functions.php.
add_filter( 'lifterlms_get_person_fields', 'llms_change_form_cols', 10, 1 );
function llms_change_form_cols( $fields ) {
foreach ( $fields as $field ) {
if ( $field['id'] === 'llms_billing_city' ){