Lance Cleveland

WP_User_Query Inverse (NOT) Search

It took a LOT longer than it should have to build an efficient query for WordPress users today. The query — an WP_User_Query INVERSE search.

The list I was trying to generate was based on two things:
– All users with a meta_key field ‘account_status’ containing the status ‘active’
– EXCLUDE all users with a nicename ending with “at_slp_dot_guru”

Turns out this is a LOT more difficult than it should be due to shortcomings in the WP_User_Query class. The solution that created the least amount of data queries , and thus improved performance over other “post filter” methods was to make use of the pre_user_query action hook that is part of WP_User_Query.

The Patch

The short version of the patch — use the pre_user_query to change an “INCLUDE all users with this search value” to an EXCLUDE for those same users. This is done by using the INCLUDE search filter than “flipping the logic” by replacing the field comparison in the WordPress-generated query to NOT LIKE instead of LIKE.

Read More

Cloning A VVV 2.6 Install

Decided to upgrade my long-term VVV setup that I use for daily client consulting work in preparation for a new gig as head of R&D and CTO for a super cool tech startup. As usual I should have left things alone as it was working fine; I only wanted to play with the newer VVV toys. You’d think I’d learn by now.

What I ended up doing was cloning a working baseline VVV install I had created a few weeks ago for the WordPress Plugin Development class I’ve been teaching at The Blockyard this year as part of the CodeBlock initiative.

Turns out this will be super useful for those nights when we have a dozen students all trying to initialize a new VVV install and we don’t have the bandwidth for 12 simultaneous 500MB box image downloads.

Here are the notes for a MacOS install. Windows will be slightly different but the same concepts apply.

Read More

Ubuntu Trusty: PHP 7.2 MIA

Working with Varying Vagrant Vagrants today and having problems spinning up a new box? Don’t blame yourself. It appears that the PHP 7.2 libs… in fact ALL of the PHP libs for Ubuntu Trusty have gone away.

The ppa:ondrej/php repository that is cited everywhere has decided it is not going to serve up any PHP code to your Vagrant boxes today.

Maybe they’ll fix it soon. Maybe not. If anyone has a workaround please comment here.

Read More

Switch from Windows to Linux

Linux is also easier to work with when setting up WordPress development through VVV — especially on older laptops.

www.slashgear.com/reasons-to-abandon-windows-for-linux-06572307/

The Code Block : WordPress Plugin Development Block 0

The very first class at The Code Block at The BlockYard is going to begin the journey with WordPress plugin development. This is a starting point only. Something to get the ball rolling. Anticipate multiple forks as we start down the “Code Block chain”. We most certainly will end up in places we don’t expect as we follow this coding journey were it takes us over the next 6 months.

Read More
%d bloggers like this: