How to Set Dashboard to Use One Column

I’m working on a plugin where I need the Dashboard to have one column for all users. While I could log into every user and change their Screen Options to one column, it would take next to forever with thousands of students accessing this site. Thankfully, I found this bit of code on Stackexchange (thanks sorich87!) and modified it for the Dashboard page. This will force all users to have one column on the Dashboard.

function screen_layout_columns( $columns ) {
$columns['dashboard'] = 1;
return $columns;
add_filter( 'screen_layout_columns', 'screen_layout_columns' );
function screen_layout_dashboard() {
return 1;
add_filter( 'get_user_option_screen_layout_dashboard', 'screen_layout_dashboard' );
view raw one-column-dashboard hosted with ❤ by GitHub

Find User ID by User MetaData

Slushman shares a custom function that allows you find a user’s ID by user metadata.

I just wrote this useful function and thought I’d share.  I’m working on a plugin for my employer, Belmont University, and I needed to find a user’s ID by the user’s barcode, which is stored as user metadata.  There’s not a built-in WordPress function to handle that, but this custom function works nicely.  You can add it to your theme’s functions.php file or to a plugin file (in my case, this is part of plugin).  Here’s the function:

Keep in mind, this returns an array, not a string.

How to Hide the BuddyPress Admin Bar (aka BuddyBar)

Many sites tell you how to hide the BuddyPress Admin Bar (aka BuddyBar), but only this code eliminates it completely from your site.

I’ve seen a bunch of sites that supposedly show you how to do this, but none are complete.  I have a client who wants to use BuddyPress, but doesn’t want the Admin Bar (I call it the BuddyBar) across the top of every page.  So I’m building a plugin called BuddyBar Widget that includes a sidebar widget with all the BuddyBar links in it.  Another part of the plugin hides the BuddyBar completely, even when you’re on Dashboard.

To hide the BuddyBar from users that aren’t logged in, go to the BuddyPress General Settings page and select “Yes” for the Hide admin bar for logged out users? option.

That’s great, but it doesn’t hide it if you ARE logged in.  For that, we’ll need some code.

EDIT ( February 1, 2012):

Ignore the old post from below. After trying to get that to work properly, I’ve switched to something far more effective. Paste the code snippet below into your wp-config.php file. I put it right above the “Authentication Unique Keys and Salts.” comment block. This works for sure. It’s not what I had hoped to do, but it works.

I created a function (I’m calling it remove_buddyadminbar), then used define to tell WordPress to turn off the BuddyBar.  This, by itself, will turn off the BuddyBar.  It may complete overkill, but I also use remove_action hooks as well.  BuddyPress uses the add_action hook in the WordPress footer to activate the BuddyBar.  Remove_action simply negates that call from BuddyPress.  You’ll notice, I also include the call for the admin_footer, which should hide the bar on your admin pages, including Dashboard.

While that’s all well and good, now you’ll notice a nice gap at the top of your admin pages.  When you kill the BuddyBar for the Dashboard, it doesn’t undo the CSS formatting that creates room for it at the top of your admin pages.  This bit of CSS takes care of that:


Using those two bits of code will completely eliminate the BuddyBar from appearing on your site.  I’ll post again about this when the plugin is ready to ship.