Skip to content

Instantly share code, notes, and snippets.

Sekander Badsha sekanderb

Block or report user

Report or block sekanderb

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
sekanderb / do_enrol.php
Last active May 30, 2020
Enroll students programmatically in Tutor LMS. Documentation link-
View do_enrol.php
public function do_enroll($course_id = 0, $order_id = 0, $user_id = 0){
if ( ! $course_id){
return false;
do_action('tutor_before_enroll', $course_id);
$user_id = $this->get_user_id($user_id);
$title = __('Course Enrolled', 'tutor')." – ".date_i18n(get_option('date_format')) .' @ '.date_i18n(get_option('time_format') ) ;
sekanderb / add-more-to-cart.php
Created Jul 3, 2019
Adds the feature to add multiple products on WooCommerce Cart
View add-more-to-cart.php
class add_more_to_cart {
private $prevent_redirect = false; //used to prevent WC from redirecting if we have more to process
function __construct() {
if ( ! isset( $_REQUEST[ 'add-more-to-cart' ] ) ) return; //don't load if we don't have to
$this->prevent_redirect = 'no'; //prevent WC from redirecting so we can process additional items
add_action( 'wp_loaded', [ $this, 'add_more_to_cart' ], 21 ); //fire after WC does, so we just process extra ones
add_action( 'pre_option_woocommerce_cart_redirect_after_add', [ $this, 'intercept_option' ], 9000 ); //intercept the WC option to force no redirect
You can’t perform that action at this time.