This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// REST Code | |
function oddc_learndash_delete_user_activity( $user_id ) { | |
if( empty( $user_id ) ) | |
return false; | |
global $wpdb; | |
$users = $wpdb->get_results( $wpdb->prepare( "SELECT activity_id FROM ". $wpdb->prefix ."learndash_user_activity WHERE user_id = %d ", $user_id ), ARRAY_A ); | |
if( !empty( $users ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adding Custom Configuration field in LearnDash Topics | |
add_filter( 'learndash_post_args', 'add_topic_option' ); | |
function add_topic_option( $post_args ) { | |
global $pagenow; | |
$topic_id = $_GET['post']; | |
// If in Topic Edit Screen | |
if ( $pagenow == 'post.php' && get_post_type( $topic_id ) == 'sfwd-topic' ) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adding Custom Redirection field in LD Courses | |
add_filter( 'learndash_post_args', 'add_topic_option' ); | |
function add_topic_option( $post_args ) { | |
// New Course field to add redirection link. | |
$redirect_on_completion = array( | |
'redirect_on_completion' => array( | |
'name' => __( 'Redirect on Completion', 'learndash' ), | |
'type' => 'text', | |
'initial_options' => '', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fetch the users from the CSV | |
$file = fopen('report.csv', 'r'); | |
while(! feof($file)) | |
{ | |
$v = fgetcsv($file); //print_r(fgetcsv($file)); | |
$user_ids[] = $v[0]; | |
} | |
// Remove duplicates | |
$user_ids = array_unique( $user_ids ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**** Custom Code to remove Paypal Payment method on checkout if cart contains subscription products. ****/ | |
/**** Place the following code at the bottom of theme's functions.php file. ****/ | |
/** | |
* Remove Paypal method from Checkout. | |
* | |
* @param $gateway_list Contains payment methods array. | |
* @return $gateway_list Contains payment methods array. | |
*/ | |
function woocs_filter_gateways( $gateway_list ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**** Custom Shortcode to display media file download link. ****/ | |
/**** Place the following code at the bottom of theme's functions.php file. ****/ | |
/**** Sample Shortcode usage: [ld_download_media_file file_url="https://www.w3schools.com/html/mov_bbb.mp4" file_icon="fa-play-circle" file_title="Some File"] | |
/** | |
* Display the link of the media file for download. | |
* | |
* @param $atts - Shortcode attributes | |
* @return string | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**** Custom Code to hide product prices based on the associatin with specific categories. ****/ | |
/**** Place the following code at the bottom of theme's functions.php file. ****/ | |
/** | |
* Remove price on product detail page | |
* | |
* @param none | |
* @return none | |
*/ | |
function remove_prices_based_on_category() { |