Skip to content

Instantly share code, notes, and snippets.

View bappi-d-great's full-sized avatar

Bappi D great bappi-d-great

View GitHub Profile
@bappi-d-great
bappi-d-great / code.php
Created July 13, 2015 05:57
Show all unit modules in single unit page
<!-- This code should be placed in single-unit.php of your child theme -->
<div class="custom_unit_details">
<?php
$unit_class = new Unit( get_the_ID() );
$unit_pagination = cp_unit_uses_new_pagination( get_the_ID() );
if ( $unit_pagination ) {
$unit_pages = coursepress_unit_pages( get_the_ID(), $unit_pagination );
@bappi-d-great
bappi-d-great / code.php
Created July 13, 2015 19:13
Apply discount automatically based on another membership
<?php
add_filter('ms_signup_payment_details', 'ms_signup_payment_details_cb', 10, 3);
function ms_signup_payment_details_cb( $invoice, $subscription, $membership ) {
$current_membership_id = 1601;
$discount = 30;
$target_membership_id = 1343;
if( $target_membership_id == $membership->id ){
@bappi-d-great
bappi-d-great / code.php
Created July 13, 2015 20:47
Updated local timezone js file to change the event date and time format - E+
;(function ($, undefined) {
$(function () {
var locale = $("html").attr("lang");
$("time[datetime]").each(function () {
var $time = $(this),
$parent = $time.closest(".wpmudevevents-date, .eab-has_events"),
datetime = $time.attr("datetime"),
$dts = $time.find((
@bappi-d-great
bappi-d-great / code.php
Created July 16, 2015 06:52
current_user_on_membership function for membership 2
<?php
if( ! function_exists( 'current_user_on_membership' ) ) {
function current_user_on_membership( $membership_id ) {
$member = MS_Model_Member::get_current_member();
$membership_items = $member->get_membership_ids();
if( in_array( $membership_id, $membership_items ) ) {
return true;
}
return false;
@bappi-d-great
bappi-d-great / code.php
Created July 16, 2015 19:58
Hightlight the search result based on search term in WPMU Global Site Search plugin
<?php
/*
Plugin Name: Global Site Search Highlight
Plugin URI: http://premium.wpmudev.org/
Description: Hightlight the search result based on search term
Version: 1.0.0
Author: Ashok (WPMU DEV)
Author URI: http://premium.wpmudev.org/
License: GPLv2 or later
*/
@bappi-d-great
bappi-d-great / code.php
Last active August 29, 2015 14:25
Show posts from Pro Sites (WPMU) sites
<?php
/*
Plugin Name: Show Pro Posts
Plugin URI: http://premium.wpmudev.org/
Description: Show posts from Pro Sites (WPMU) sites
Author: Ashok (WPMU DEV)
Version: 1.0.0
Author URI: http://premium.wpmudev.org/
*/
@bappi-d-great
bappi-d-great / reset-upfront-themes.php
Last active September 8, 2015 07:21
Reset Upfront Themes
<?php
/*
Plugin Name: Upfront Theme Manager
Plugin URI: http://premium.wpmudev.org
Description: Reset, Export and Import Upfront themes.
Version: 1.1.1
Author: Ashok, Philipp (Incsub)
Author URI: http://premium.wpmudev.org/
Textdomain: utm
License: GNU General Public License (Version 2 - GPLv2)
@bappi-d-great
bappi-d-great / code.php
Created July 22, 2015 20:56
Enable WPMU DEV Chat for all BP users, not friend only
<?php
// Please go to /plugins/wordpress-chat/lib/wpmudev_chat_buddypress.php line no 57 to 106 and replace:
function wpmudev_chat_buddypress_member_header_actions() {
global $bp, $members_template, $wpmudev_chat, $current_user;
if ( $bp->loggedin_user->id === bp_displayed_user_id() ) {
return;
}
@bappi-d-great
bappi-d-great / code.php
Created July 23, 2015 15:32
WPMU Membership 2 - integration with Network Limited Email Registrations
<?php
add_filter( 'wpmu_validate_user_signup', 'wpmu_validate_user_signup_cb', 99, 1 );
function wpmu_validate_user_signup_cb( $arr ) {
if( is_multisite() ){
$user_email = $arr['user_email'];
$errors = $arr['errors'];
$limited_email_domains = get_site_option( 'limited_email_domains' );
if ( is_array( $limited_email_domains ) && empty( $limited_email_domains ) == false ) {
$emaildomain = substr( $user_email, 1 + strpos( $user_email, '@' ) );
@bappi-d-great
bappi-d-great / code.php
Last active August 29, 2015 14:25
Show Network Information
<?php
/*
Plugin Name: Network Information
Plugin URI: http://premium.wpmudev.org/
Description: Shows information with a network
Author: Ashok (WPMUDEV)
Version: 1.0.0
Author URI: http://premium.wpmudev.org/
Network: True
Text Domain: ni