Skip to content

Instantly share code, notes, and snippets.

View toluaddy's full-sized avatar
💭
I may be slow to respond.

toluaddy

💭
I may be slow to respond.
View GitHub Profile
@toluaddy
toluaddy / sync_member_type_roles.php
Created February 3, 2020 12:44 — forked from codelion7/sync_member_type_roles.php
Sync the roles associated with each of the user's member types on each subsite of a multisite network
/**
* Retrieves an array of all network sites
*
* @since 1.0
* @return array
*/
function get_network_sites() {
global $wpdb;
$blogs = $wpdb->get_results("
@toluaddy
toluaddy / bp-global-member-types.php
Created February 3, 2020 12:45 — forked from codelion7/bp-global-member-types.php
Enable Global Member Types in BuddyPress
<?php
/**
* Sets a user's buddypress member type(s) globally across all sites
*
* @since 1.0
*/
function bp_set_global_member_type( $user_id = 0, $member_type = '', $append = false ) {
// Append new member type to global member type array
if ( $append == true ) {
@toluaddy
toluaddy / sync_member_type.php
Created February 3, 2020 16:43 — forked from codelion7/sync_member_type.php
Sync BuddyPress Member Type to Another Blog on a Multisite Network
<?php
function sync_member_type( $user_id = 0 ) {
if ( empty( $user_id ) )
$user_id = get_current_user_id();
$memb_types = bp_get_member_type( $user_id, false );
switch_to_blog( 3 );
@toluaddy
toluaddy / wpwfp-buddypress-author.php
Created February 3, 2020 16:46 — forked from wpweb101/wpwfp-buddypress-author.php
Follow My Blog Post - Add Author Follow Button on buddypress user profile page
<?php
function bp_profile_header_meta_func(){
$author_id = bp_displayed_user_id();
echo do_shortcode('[wpw_follow_author_me author_id = "'.$author_id.'" ]');
}
add_action('bp_profile_header_meta','bp_profile_header_meta_func');
@toluaddy
toluaddy / README.md
Created February 3, 2020 16:48 — forked from ControlledChaos/README.md
List of Conditional Template Tags for BuddyPress

List of Conditional Template Tags for BuddyPress

WordPress Snippets

@toluaddy
toluaddy / jmw_make_edit_default_for_own_bp_profile.php
Created February 3, 2020 16:53 — forked from calliaweb/jmw_make_edit_default_for_own_bp_profile.php
BuddyPress - make edit screen the default for own profile
<?php
add_action( 'bp_setup_nav', 'jmw_make_edit_default_for_own_bp_profile', 15 );
/*
* Edit the buddypress menus
*/
function jmw_make_edit_default_for_own_bp_profile() {
global $bp;
if ( ! bp_is_my_profile() ) {
@toluaddy
toluaddy / conditional_bbpress_style.php
Created February 3, 2020 16:55 — forked from DanielBakovic/conditional_bbpress_style.php
Conditional loadinf of bbPress CSS/JavaScripts
<?php
function conditional_bbpress_styles_scripts() {
// First check that bbpress exists to prevent fatal errors
if ( function_exists( 'is_bbpress' ) ) {
//dequeue scripts and styles
if ( ! is_bbpress() && ! is_buddypress() ) {
wp_dequeue_style('bbp-default');
wp_dequeue_style( 'bbp_private_replies_style');
wp_dequeue_script('bbpress-editor');
}
$new_group = new BP_Groups_Group;
$new_group->creator_id = 1;
$new_group->name = 'test';
$new_group->slug = 'test';
$new_group->description = 'nothing';
$new_group->news = 'whatever';
$new_group->status = 'public';
$new_group->is_invitation_only = 1;
$new_group->enable_wire = 1;
@toluaddy
toluaddy / bp-custom.php
Created February 3, 2020 17:05 — forked from imath/bp-custom.php
Edit BuddyPress primary nav so that profile primary item is before the activity primary item
<?php
/**
* BuddyPress 2.6.0 introduced a new nav API
* with a Backcompat mechanism. But accessing/editing
* deprecated globals can lead to such problems...
*
* It's too bad Theme designers forget to test betas :)
*/
function strothi_profile_primary_nav_first() {
@toluaddy
toluaddy / wp-idea-stream-custom.php
Created February 3, 2020 17:11 — forked from imath/wp-idea-stream-custom.php
Add a confirmation prompt to remove link in BuddyPress groups.
<?php
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
function georgio_idea_footer_actions( $footer = '' ) {
if ( ! bp_is_group() ) {
return $footer;
}