Buddypress hide the top level tabs from users ( e.g. hide the group tab)

This is to hide the top level tabs from users. Based on this code from the buddypress forums. define( ‘BP_DEFAULT_COMPONENT’,’profile’ ); // this shows something if no tabs (otherwise 404) function bpfr_hide_tabs() { if ( bp_is_user() && !is_super_admin() ) { /* and here we remove our stuff ! */ //bp_core_remove_nav_item( ‘activity’ ); //bp_core_remove_nav_item( ‘friends’ ); … Read more

Buddypress how to remove tabs from groups sub tabs ( eg remove Delete group)

This code is based on a post from the buddypress forums tested on Buddypress 2.9.2  ( forum states its compatible from BP 2.6+). In this example we remove the Delete tab and also permission so that user can’t try and goto the url to access it. Note there are numerous other examples / versions of … Read more

WordPress SQL snippets

A place to keep snippets of useful WordPress SQL. Do a select based on some meta field of a post ( i.e. search for a post that has a particular metafield  ) SELECT p.ID,p.post_title, MAX(CASE WHEN pm1.meta_key = ‘id_vim_node’ then pm1.meta_value ELSE NULL END) as field_i_want FROM wp_posts p LEFT JOIN wp_postmeta pm1 ON ( … Read more

Flexbox cheatsheet

update: this is a very useful cheatsheet also (with lots of pics to explain) css tricks guide to flexbox Equal width columns (responsive i.e. Rows on small screen width) <div class=”container”> <div ></div> <div ></div> <div ></div> </div> .container { display:flex; } .container div {flex-basis:100%;} @media screen and (max-width:600px) { .container { flex-direction: column; } … Read more

WordPress on Windows IIS permissions error – uploaded file could not be moved to wp-content/uploads

Recently I’ve been developing a WordPress Intranet for a company that runs on Windows hosting ( IIS 6 – Internet Information Services ). I ran into a problem with file permissions and not being able to write to the wp-content/uploads directory, I’ve ran into the same problem with unix many times (which alittle bit of recursive … Read more