In Uncategorized on June 18, 2014 at 10:00 am

Just a quickie for people having trouble trying to get Xdebug to work inside PhpStorm using Mamp / Mamp Pro. 

This took me a few days to twig. Your Mamp port is set to :8888 and Xdebug is set to :9000.

Set Xdbug to the same port as Mamp (8888) and problem solved.


BuddyPress – Alphabetical and by Surname.

In Work on November 21, 2012 at 12:40 pm

I’ve been building a custom WordPress website for a client recently and been having a steep learning curve getting my head around the BuddyPress plugin. While a terrific app, giving you all the features of Facebook for my client’s users, it’s also very hard to find good documentation for the way the plugin works – such as getting various data elements. It took me a while to realise that you can actually pull out elements of data by simply adding ‘get’ to the request string, so for the avatar putting bp_member_avatar() would get you the members avatar image, but putting bp_get_member_avatar() would give you the full data string, not automatically echoed when returned.

Anyway, the problem was taking the members list and returning them in a alphabetical state, Buddypress’s default state is ‘active’, so finding a way of making them display as A-Z became a bit of a challenge,  searching various blogs via Google I found that you can add commands to alter the output, so on ‘members-loop.php‘, at the line that reads

if ( bp_has_members( bp_ajax_querystring( ‘members’ ) ) ) :

you can add

. ‘&type=alphabetical&per_page=40’ 

so that it becomes

if ( bp_has_members( bp_ajax_querystring( ‘members’ ) . ‘&type=alphabetical&per_page=40’ ) ) :

What this is doing now is telling BuddyPress to make the members list display as A-Z with 40 members per page instead of the default 20. The only trouble with this though is that it displays your members alphabetically by their first names – Adam Zebra, Bill Alpha, Charlie Woods instead of Bill Alpha, Charlie Woods, Adam Zebra. My solution was to break up the loop into an array and sort it alphabetically by last name.

You can also ‘hard-code’ this by going to the actual function found on ‘bp-members-template.php‘. Go to line 264 you see the function ‘function bp_has_members( $args = ” ) {‘ this is where you can set all the arguments (active ( default ) | random | newest | popular | online | alphabetical).

As I mentioned earlier, finding out how to get at various BuddyPress elements using the ‘get’ statement was vital for this.

Starting around line 30, here is my solution:


do_action( ‘bp_before_directory_members_list’ );

$members_list_array = array();

while ( bp_members() ) : bp_the_member();

$name_temp = explode(” “, bp_get_member_name());
if ($name_temp[1]==””) { $name_temp[1] = $name_temp[0];}

array_push($members_list_array, array( “link” => bp_get_member_permalink(), “full” => bp_get_member_name(), “icon” => bp_get_member_avatar(), “first” => $name_temp[0], “last” => $name_temp[1] ) ); 


foreach($members_list_array as $key => $row) { $atoz[$key] = $row[“last”]; }

array_multisort($atoz, SORT_ASC, $members_list_array);


The ‘magic’ happens in the last line of the code, from here you can manipulate your array data in anyway you need – for myself I had to output the content into four rows.

Displaying BuddyPress members, alphabetically by surname

Hope this helps any other BuddyPress users.


In Work on June 4, 2012 at 4:08 pm

Started a new project recently and thought it was time to get involved with frameworks after reading a few articles about  sass and less. So, I took the plunge, bought a copy of the excellent ‘CodeKit’ app and started building.

Gotta say I love working with the .jade template engine – it’s so quick at throwing together a html page with all the shortcuts

short and sweet coding

To go with that I’m using SASS/SCSS with the Compass library to style the page. Another terrific time-saver code wise, letting you use variables to organise your code, such as ‘$width: 800px;’ and ‘$cola: $width/2;’