Skip to content

Instantly share code, notes, and snippets.

View madhvendras84's full-sized avatar

Madhvendra Singh madhvendras84

View GitHub Profile
<script>
jQuery(document).ready(function($){
$("body.registration.register form#signup_form>p").text("Warning: Do not create more than one account.");
});
</script>
@madhvendras84
madhvendras84 / functions.php
Created December 12, 2018 10:32
Hide all expired courses from students except Google Bot
add_action('template_redirect',function(){
/*if(!is_singular('course') || is_page(vibe_get_bp_page_id('course')))
return;
*/
$course_ids = get_transient('expired_courses');
if(empty($course_ids)){
add_action('course_action_points',function (){
$course_id = $_POST['course_id'];
if(empty($course_id) && !empty($_COOKIE['course'])){
$course_id = $_COOKIE['course'];
}
add_filter('bp_course_single_item_view',function ($flag,$post){
$course_post_id = $post->ID;
$course_author= $post->post_author;
$course_classes = apply_filters('bp_course_single_item','course_single_item course_id_'.$post->ID.' course_status_'.$post->post_status.' course_author_'.$post->post_author,get_the_ID());
?>
<li class="<?php echo $course_classes; ?>">
<div class="row">
<div class="col-md-4 col-sm-4">
<div class="item-avatar" data-id="<?php echo get_the_ID(); ?>">
<script>
jQuery(document).ready(function(){
if(jQuery('div#vibe_bp_login').hasClass('active')){
jQuery('header').css('position','initial');
}else{
jQuery('header').css('position','absolute');
}
add_filter('bp_course_single_item_view',function ($x,$post){
$course_post_id = $post->ID;
$course_author= $post->post_author;
$course_classes = apply_filters('bp_course_single_item','course_single_item course_id_'.$post->ID.' course_status_'.$post->post_status.' course_author_'.$post->post_author,get_the_ID());
?>
<li class="<?php echo $course_classes; ?>">
<div class="row">
add_filter('bp_get_course_check_course_complete_stop',function($flag,$course_id,$user_id){
//Check for unit completion
$course_curriculum=bp_course_get_curriculum_units($id);
if(isset($course_curriculum) && count($course_curriculum)){
$flag =0;
foreach($course_curriculum as $unit_id){
//if(is_numeric($unit_id)){
$unittaken = bp_course_check_unit_complete($unit_id,$user_id,$id);
if(empty($unittaken) && bp_course_get_post_type($unit_id) == 'quiz'){
$unittaken=get_user_meta($user_id,$unit_id,true);
@madhvendras84
madhvendras84 / gist:39961d601deafe23d137383d8b603475
Created April 18, 2019 08:32
Auto trigger finish course when student pass the quiz or used up retake attempts
add_action('wp_footer',function (){
?>
<script>
function check_quiz_marks(){
var qid = jQuery('.course_timeline ul li.active a').data('unit');
<?php
/**
* TIPS from MUSettings - General section
*
* @class WPLMS_tips
* @author VibeThemes
* @category Admin
* @package Vibe customtypes
* @version 1.0
*/
<?php
//Header File
if ( ! defined( 'ABSPATH' ) ) exit;
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<?php
wp_head();