Categories
Code WordPress

Batch Update Multiple Git Repositories

This is a small shell script I use to batch update all of my git repositories that are children of a particular folder on my filesystem.

First create a single common folder to checkout all of your projects.  We’ll use vc.

mkdir ~/vc; cd ~/vc

Then place the following file inside the folder.

Now checkout your repositories into subfolder.

git clone https://github.com/stevenkword/WP-Present.git wp-present

You should now end up with a folder ~/vc/wp-present/ and we can test our update script.

sh ~/vc/update-git.sh

The script should traverse all of the subfolders and issue git pull commands in each.

Categories
Code WordPress

Use Wildcards with WP_User_Query to Search for WordPress Users

Information about how to use the wildcard user search in WP to properly populate things like JSON arrays for use with autocomplete JS.

WP_User_Query()

Categories
Code WordPress

WP CLI Batch Import

Sometimes you may receive your WordPress export XML files broken up into chunks.  When this happens, it can be cumbersome to import each file one-by-one.  Instead, try throwing everything into a sub-folder and running the following shell script:

Categories
Code WordPress

BuddyPress: Disable the Public Members Directory

The following code snippet can be used to disable access to the default BuddyPress Members Directory.  Simply add the following code to your theme’s functions.php file.

//Disable members directory
function disable_directory_members() {
 global $bp, $wp_query;
 $bp_is_directory = false;
 bp_core_redirect( $bp_root_domain );
}
add_action( 'bp_core_action_directory_members', 'disable_directory_members', 2 );

Update – 11/17/2011:  As of BuddyPress v1.5 this post this method is deprecated. You can now achieve this same result by unpublishing the ‘Members’ page from the ‘Pages menu in the admin area.

Categories
Code WordPress

BuddyPress: Remove a Sub Item from a Navigation Menu

This example demonstrates how to remove the Notifications item from the BuddyPress Settings default navigation menu. Simply add the code below to your theme’s functions.php file.

Here is a similar example that could be used to remove the System Notices menu from the Messages section.