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 February 6, 2015 00:39
WPMU Appointments+ tabify service calendar add on
<?php
/*
Plugin Name: Tabify Services
Description: Create a tab or services
Plugin URI: http://premium.wpmudev.org/project/appointments-plus/
Version: 1.0
AddonType: ShortCode
Author: WPMU DEV
*/
@bappi-d-great
bappi-d-great / code.php
Last active August 29, 2015 14:14
List of BuddyPress friends of all users
<?php
// Use shortcode [show_bp_friendship] - by default it will show the users that don't have any friends.
// To hide those users use shortcode [show_bp_friendship hide_alone="true"]
function show_bp_friendship_cb( $atts ){
$atts = shortcode_atts( array(
'hide_alone' => false
), $atts );
global $wpdb;
$users = get_users();
@bappi-d-great
bappi-d-great / keybase.md
Created February 7, 2015 18:37
keybase.md

Keybase proof

I hereby claim:

  • I am bappi-d-great on github.
  • I am aknath707 (https://keybase.io/aknath707) on keybase.
  • I have a public key whose fingerprint is CF9B F5E6 FCC9 C09D 012B 18A6 092E 8818 C3BB 9013

To claim this, I am signing this object:

@bappi-d-great
bappi-d-great / code.php
Created February 9, 2015 19:49
Add to a membership when register in WPMU protected content plugin
<?php
add_action( 'user_register', 'add_membership_on_register', 10, 1 );
function add_membership_on_register( $user_id ) {
// Give the membership ID here
$mem_id = 28;
$mem = new MS_Controller_Member();
$mem->member_list_do_action( 'add', array( $user_id ), $mem_id );
}
@bappi-d-great
bappi-d-great / Show featured image in eab_archive shortcode in WPMU Events.php
Created March 9, 2015 17:44
Show featured image in eab_archive shortcode in WPMU Events+
@bappi-d-great
bappi-d-great / code.php
Last active August 29, 2015 14:16
Take extra data when someone click on "I am attending"
<?php
add_filter( 'eab-rsvps-button-no', 'get_req_form', 10 );
function get_req_form( $content ){
global $post;
if( is_user_logged_in() )
$form = '<div class="sp_req_wrap"><textarea name="sp_req" placeholder="Special Request"></textarea></div>';
else
$form = '';
@bappi-d-great
bappi-d-great / code.php
Created March 12, 2015 21:33
WPMU A+ use default name and email when profile meta field is empty and booking created by the admin
<?php
add_filter( 'app-appointment-inline_edit-save_data', 'app_inline_save_cb' );
function app_inline_save_cb( $data ){
$user = get_userdata( $data['user'] );
if ( username_exists( $user->user_login ) ){
$data['email'] = $data['email'] == '' ? $user->user_email : $data['email'];
$data['name'] = $data['name'] == '' ? $user->display_name : $data['name'];
}
return $data;
@bappi-d-great
bappi-d-great / code.php
Last active November 18, 2017 23:13
Change post author to subsite admin if the author is super admin
<?php
add_action( 'admin_init', 'change_author_cb' );
function change_author_cb() {
//$sites = wp_get_sites();
// Set super admin ID here
$super_admin_id = 1;
//foreach( $sites as $site ){
@bappi-d-great
bappi-d-great / code.php
Last active August 29, 2015 14:19
Assign default membership to an user when registers
<?php
add_action( 'user_register', 'add_default_membership', 10, 1 );
function add_default_membership( $user_id ) {
// Give the default membership ID here
$memberships = array( 1601 );
$member = MS_Factory::load( 'MS_Model_Member', $user_id );
@bappi-d-great
bappi-d-great / mu-plugin.php
Created May 11, 2015 21:43
Add wiki activities in BuddyPress activities
<?php
add_action( 'save_post', 'add_wiki_activity_to_bp' );
function add_wiki_activity_to_bp( $post_id ) {
if( get_post_type( $post_id ) == 'incsub_wiki' ) {
if ( ! function_exists( 'bp_activity_add' ) ) return false;
$user_id = get_current_user_id();
$user_info = get_userdata( $user_id );