October 2013

Installing gearmand, libgearman and pecl gearman extension for php from source in Debian 6 & 7

I had a pretty rough evening today. No, not because the waiter forgot to add sugar in my tea, but because it was so boring to go through the trial and errors of installing gearman daemon and pecl gearman extension for php. First I tried with the pretty-obvious-awe-fucking-some way. [sourcecode language=”shell”] apt-get update apt-get install …

Installing gearmand, libgearman and pecl gearman extension for php from source in Debian 6 & 7 Read More »

QuickTip: Turn symfony's web profiler debug bar on or off

Check out your config_dev.yml and you will notice a special section over there [sourcecode language=”shell”] web_profiler: toolbar: true intercept_redirects: false [/sourcecode] You can turn the debug bar on or off anytime by changing the value of toolbar in this web_profiler section. If you want to turn debug bar off for a specific controller action, you …

QuickTip: Turn symfony's web profiler debug bar on or off Read More »

Install and Run Symfony 2.3.6 projects in OpenShift instances in just one minute with this boilerplate repository

Okay, I have written an article 2 days ago where I went through every details. But today. I have created a blank symfony container with all the necessary deploy hook and mods so that you can get your symfony 2 project up and running in an openshift container within a minute, fully automated, seriously! Github …

Install and Run Symfony 2.3.6 projects in OpenShift instances in just one minute with this boilerplate repository Read More »

How to login a user programatically in Symfony2

Sometime, you may need to log in an user manually from code, instead of generic form based log in. To do it, you need to use Two Security component “UsernamePasswordToken” and “InteractiveLoginEvent”. We will also use another exception object “UsernameNotFoundException” if the user is not found. [sourcecode language=”php”] use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; [/sourcecode] …

How to login a user programatically in Symfony2 Read More »

Get a list of Top 10 authors in a WordPress blog, and sort them by firstname and last name

Getting top 10 authors’s list from WordPress is actually pretty simple with a SELECT query. Here is the SQL for that which sorts the list by number of posts of each authors [sourcecode language=”sql”] SELECT wp_users.id, display_name, user_login, user_nicename, count(wp_posts.id) AS number_of_posts FROM wp_users JOIN wp_posts ON wp_posts.post_author = wp_users.id GROUP BY wp_posts.post_author ORDER BY …

Get a list of Top 10 authors in a WordPress blog, and sort them by firstname and last name Read More »

Improving UX in the WordPress Admin Panel with Interactive Meta Boxes

Our goal is simple today, we want to add interactivity to our boring metaboxes. Instead of showing lots and lots of irrelevant input boxes at once, we will properly group them into different metaboxe containers and then display the required one based on the action of another one. We will create a custom post called …

Improving UX in the WordPress Admin Panel with Interactive Meta Boxes Read More »

Limit number of posts an user can create in WordPress admin panel

If you, by any chance, want to limit the number of posts an user can create in your multi author WordPress blog, there is a nice way to do it. Add the following code in your theme’s functions.php file [sourcecode language=”php”] add_action("load-post-new.php","limit_user_by_post_count"); function limit_user_by_post_count(){ $user = get_current_user_id(); if (!current_user_can( ‘manage_options’)) { //not an admin – …

Limit number of posts an user can create in WordPress admin panel Read More »

Running Symfony 2 Applications in OpenShift

Openshift is a fantastic Polyglot PaaS from Redhat, and you can do a lot of things with these containers. The good news is that with free accounts, OpenShift gives three gears for free, forever. Today, in this article I will show you how to install and run your Symfony applications in OpenShift. After you have …

Running Symfony 2 Applications in OpenShift Read More »

Launching of WPonFIRE, the premier managed WordPress hosting for everyone

Today me and my partner Patrick have launched WPonFIRE, our WordPress based startup. If you are struggling with the performance of your wordpress blog, or spending too much because of some vague pageview based pricing model of your current provider – you may want to host with us. We will host your wordpress blog in …

Launching of WPonFIRE, the premier managed WordPress hosting for everyone Read More »