Laravel how to set a checkbox value to checked based on models value

In this post I’ll show how to set a Laravel checkbox value to checked based on the value stored on the model. In this example I’ll be using the Laravel Collective Form checkbox {{ Form::checkbox(‘collected’ /* name */, “yes” /*value*/, old(‘collected’, $gas_cert->collected==”yes”?true:false ) /* true sets checked */ ) }} In the code example above … Read more

How to override the comments form in a child theme

This is a quick post on how to provide your own comments template in your child theme ( overriding comments.php in your parent theme). You can just as easily use the same code to override comments.php if you aren’t using a child theme. Todo this you need to you need to use the filter ‘comments_template’ … Read more

How to engage your staff using your Intranet

In this article, we’ll look at some ideas for useful things to have on your intranet and how to use these to help engage your Employees, members or Volunteers. What are the benefits of engaged staff ? Happy workforce ( productive workforce, helps business be more profitable) Low Staff turnover ( saves money in recruitment … Read more

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