How to get a users Roles and how to list all WordPress roles in PHP

This code is handy if you want to find out a users role/s. You could expand it and check if a user has a given role or similar. $user_info = get_userdata(2152); echo ‘Username: ‘ . $user_info->user_login . “\n”; echo ‘User roles: ‘ . implode(‘, ‘, $user_info->roles) . “\n”; echo ‘User ID: ‘ . $user_info->ID . … Read more

Importing a MAMP mysql database on mac (OS X Yosemite)

How to import a MAMP mysql database (bypassing phpmyadmin problems) Recently I’ve being have a problem importing a large database in MAMP Mysql via phpmyadmin (and after altering various php variables in php.ini, I still couldn’t get it to import). So I tried another approach to import it from the command line a quick google … Read more

Plugins that can help to increase sales and conversions in Woocommerce 2017

automating sales in Woocommerce

There are many great plugins that can help to increase sales in Woocommerce in this blog post I’m going to talk about 2 very effective plugins in this space: AutomateWoo and SumoMe .   AutomateWoo for increasing sales in Woocommerce AutomateWoo has a lot of great features that can be setup to work automatically based on certain triggers, … Read more

How to do Ajax in WordPress

updated 10th Jan 2018 Write a javascript function to trigger the ajax call jQuery(‘#button_or_something’).on(“click”, function() { jQuery.ajax({ url: ajax_object.ajax_url, data: { action: ‘like_or_not’, /* this is appended to add_action on server side */ id: ’99’ }, type: ‘GET’, success:function(response){ //alert(‘back from ajaxe ‘+response); /* if you want to update something based on the response text … Read more