Call   0208 3131682   Mon-Fri 9am-6pm
All Posts By


In WordPress Recent Posts Widget , only show posts tagged with the current page url

By | Uncategorized | No Comments

Setting up a Laravel app on Docker

By | Apache, Docker, Laravel, linux | No Comments

Rough notes, will pull this togther in a blog post at later date.


The requested URL /login/ was not found on this server.


add to manually enable mod rewrite on command line in the container:

# launch a terminal in the container

docker exec -it e39431779799 bash

# enable modrewrite

a2enmod rewrite

/etc/init.d/apache2 reload



could not find driver (SQL:


Add this to Dockerfile:

RUN docker-php-ext-install mysqli pdo pdo_mysql

docker-compose build

then bring it up:

docker-compose up -d

Use anonymous functions sparingly

By | Javascript, Programming Tips and Best Practices | No Comments

This is the first of a bunch of posts I’m going to write on programming tips and best practices.

This one is about Anonymous functions ( a sometimes useful technique if your going to use in one place and throw away ). 

And thats all well and good, however these make code more difficult to understand ( especially large code bases you need to maintain ).

For example imagine some code you need to maintain, lets say it starts off with a long file you need to read through and get a high level understanding of. If its littered with anonymous functions it’s makes it hard to understand (quickly, quickly being the operative word, we’re busy people after all with lots of a new features the boss wants to add).

Is this easier to understand (approach 1)


Than this


It’s quicker and easier to read and understand the 2nd code ( we don’t even need to read the function ‘toggleDisplayOfControls’ because from its name it’s obvious what it does).

To take this one step further we can nicely comment the function (toggleDisplayOfControls) at the top ( as is standard ) if needed (in my experience anonymous functions are rarely commented).


Adding javascript functions to Laravel Mix ( and why you get error Uncaught ReferenceError: function is not defined )

By | Javascript, Laravel, Programming | No Comments

This one had me pulling my hair out the other day. I was using Laravel,  adding a javascript function to the app.js file ( also tried using require in app.js and pulling in my function ). Laravel uses Laravel Mix which is a wrapper for webpack.

Yet with either approach I was getting the javascript error:

Uncaught ReferenceError: testing_helloworld is not defined

It seemed to be working ( had npm run watch , compiling it and doing a view source I could see the function in my javascript app.js file ).

My function source code looked like this:

It seems webpack wraps this in IIFE (see details on mozilla site )

This has the effect of wrapping it in its own scope ( and not in the global scope ).

So to put it in the global scope, so you can call it anywhere, you need to pop the function onto a global such as Window as below:

thanks stack overflow ! 

I’d have read through my app.js file , but it was massive and would have taken me awhile to find this I think ! Hope this helps someone else with Laravel Mix, Webpack and adding your own javascript functions.



Exporting Forum data from BBPress

By | BBPress, Migration, SQL | No Comments

This is how to export data from BBPress, which would be useful if you wanted to migrate from BBPress to another forum platform.

Its straight SQL export direct from the mysql database, with things like forum posts (topics ) and forum replies, as well as some other data including users ( and their user ids etc ).

I’ve exported the forum data into a table, then escaped the quote marks and finally output into a csv (comma separated list ) file that can be used to suck into the relevant system , where you’re moving the BBPress forum to.



Hide Buddypress members pages from guests ( also hide BBpress forum posts)

By | PHP, Website Development, Wordpress | No Comments

The code below is to hide sections of a WordPress website from guests (hide certain pages or groups of pages on a WordPress , so they are only available for logged in users).

In this case we’re hiding all the Buddypress members pages from guests ( so hiding all pages that start with /members such as member profiles and so on). We’re also  hiding BBpress forum topics ( but they can still view the forums and forum post / topic names ).

If a guest is trying to view a page (that we’re not allowing them to, they are sent to the homepage).