Best Code Editor for PHP

by Todd Armstrong on November 2, 2013

Code ReadabilityIf you’re looking for a WYSIWYG editor, this isn’t the post for you.

I’ve tried a ton of code editors in my time. In my opinion, there are few good ones out there despite the large variety of editors both free and paid. Many of the ones I’ve tried are based off the same foundation, Eclipse. There are certain basic functions I need in an editor. I won’t consider one without them:

  • syntax highlighting for specific languages
  • ability to group files by project or folders
  • good search & replace with REGEX capabilities
  • good UI/UX

That’s a short list, right? Sometimes I’m easy to please.

The Past

The editor I used for a long time was NetBeans. NetBeans is a pretty good app. It has the basic functions that I need and a few extras that were nice to have such as changing the theme (look & feel – I like a dark background with light text) and code completion. It also has the ability to work directly with code repositories within the IDE. Although I never got that to work correctly, that’s probably more user error than a fault of the app.

The problem with NetBeans (and this became a huge problem) is that it’s heavy. The more “projects” I put into it the heavier it got. It took up a lot of memory just opening the program and it also spent a lot of time “scanning” my project folders for changes. Something I never wanted it to do but (at least at the time I had it) something you couldn’t stop it from doing. At a certain point, it got too cumbersome for me to use.

The Search

I went on a search for a better app…and I mean a long search. And I tried a lot of editors. PHP Storm, Aptana, phpDesigner, Eclipse, TextPad, a couple for MAC (TextMate & Coda), and on, and on, and on.

Each one had its issues and just didn’t fit what I needed. I had settled on Aptana for a while…then along came SubmileText.

The Search Is Over

The first thing I noticed about SublimeText is the speed. It opens fast and doesn’t get bogged down. It’s not a memory hog so I can have it open for days and it won’t cripple my system.

However, it doesn’t stop there. SubmileText has a ton of features that make it outstanding. The search function is awesome. You can search in files or search for code completion. Snippets for code is great too and it’s easy to write your own. Syntax highlighting is top notch and it supports a ton of languages. You can download plugins or addons that the community writes as well and these don’t weigh down the app at all. There’s also a ton of little things that make it great. I don’t know how I lived so long without multiple cursors!

I’m still learning new things SublimeText can do and I’ve been using it for over almost 2 years.

If you write code for a living (or just a hobby) I suggest you give it a try (it’s free to try) I did and it made all the difference in my work.

{ Comments on this entry are closed }

WordPress Custom Fields in User Profiles

by Todd Armstrong on October 26, 2013

Recently, I had the need to have custom fields in my WordPress user profiles. The specific reason I needed it was to be able to show different content to different users based on certain attributes. Also, I needed to echo out some values to those users as instructions or directions.

So, as I typically do, I went searching for a plugin that performs this task. This is my first step in the process because I’m a big fan of “not reinventing the wheel” and if someone out there has done this already I should be able to implement it and continue to work on my specific features.

I found a lot of plugins that do this task. However, they all had a basic foundation in user registration and the users themselves editing/updating/viewing their profiles. Some of the values I needed to give to users, I didn’t want them to edit. Finally I settled on one by ThemeFuse called “Extend User Profile“. (NOTE: This plugin hasn’t been updated since 2012 and I don’t really recommend it – keep reading)

I settled on this plugin because time was short and I still needed to do a lot of coding. Ultimately, it was a pain in the ass though because while it did allow me to add custom user fields to the profiles, it stored them all in a single meta value in the WordPress database. I couldn’t get rid of the default ones that came with it (Facebook, LinkedIn, & Twitter) which I didn’t need either. Managing the users was a pain and it took 3 of us at work to figure out how to import the almost 1,800 users I needed to import. The code I had to write to grab those values was a bit long as well.

Once I got it to work and had all the users in there, it performed the way I needed it to. This was a short lived site anyway.

Phase 2

Then Phase 2 came along. I already knew I was going to dump this plugin and I went on a search for a different one. Clearly someone must have accomplished this before, right? After searching many different corners of the Internet, I decided everything I found was either too complicated and I’d have to trick it to get it to work the way I needed (bad idea – see above) or it was overkill for what I needed. That leaves one remaining solution: write my own plugin.

I’m no stranger to writing my own plugins, so this wasn’t a huge deal to me. It just meant I’d have to spend more time coding than I had originally planned. So I went out to figure out how to code in more fields into the user profiles. The answer I found really surprised me: This is so flippin easy to do.

To be honest, it really shouldn’t have surprised me that it’s easy to code your own custom fields. After all, this is WordPress and the user profile has been around forever.

So if you need a simple solution to programming custom fields into your user profiles, see the code below.

This is the function that will show the input fields in the user profile page of the WordPress Admin. (goes in functions.php)

  • I always put  im_ in front of any function name I create.
  • Replace  FirstCustomField  with whatever you want to name the field.

If you need more fields, just copy/paste from the <tr>  to the  </tr>  and replace the labels for your new field. Now, just below this function you’ll need to add these two lines of code that will run the function above.  (goes in functions.php)

But we’re not done quite yet. Now we need to tell WordPress to save the data into the database. (goes in functions.php)

Upload your new functions.php file and you should now see your new field[s] in the user profile section.


If you need to use these fields in other places of your site (like I did), there’s an easy way to grab them.

To echo the value out to the browser window, simply call  the_author_meta( $meta_key, $user_id )  in your theme file or custom function where you want that value to be displayed. Note that  $meta_key  is the name of the field you gave. So if I wanted to display the value from the above example I would add:

In my theme file where I wanted that to be displayed.

If you want to grab that value as a variable instead the code you use is  get_the_author_meta( $meta_key, $user_id ) . So let’s say (again, using the above example) I wanted to store the value of  FirstCustomField  into a variable named  $myfield  for use later. I would use this code below:

Hopefully this will save someone some time browsing around for plugins if you’re just looking for a simple way to add a few custom fields.

The next part of what I’ll be doing is adding an import function that will take a bunch of users from something like a CSV and import the users along with their custom fields and values.


{ Comments on this entry are closed }

Facebook Open Graph Tags for Sharing

May 1, 2013

In my line of work Facebook is a necessary evil. I say evil because it sucks tying to work with them. They constantly change their platform but don’t update the documentation. There’s zero customer support for when you want to get something *fixed*. Yes, they offer their service for free (bombarded with ads) so there’s […]

Read the full article →

Why You Should Dump Your Home Page Slider

April 19, 2013

What do you want people to do when they get to your site? Find what they’re looking for quickly? Get an answer to their question? Fill out a form to get more information from you (lead generation)? Buy one of your products? Or do you want them to passively sit there watching/staring at their screen […]

Read the full article →

My Essential WordPress Plugins

April 15, 2013

It’s no secret that I use Wordpess for a lot of my work. It just makes sense for most of my projects. If it’s not a custom web app a client needs, I’ll start with WordPress. Any time I fie up a new WordPress site, I have a set of plugins that I’ll always use […]

Read the full article →

Where I Keep My Web Development Tips & Tricks

April 13, 2013

Not that I ever envision this site to get even moderate traffic, but I do need to write here more often. Mostly because it’s a good place to keep bits of code, web tips & tricks, cool links, wordpress pro tips, etc. Have I been doing that? Of course not, which is why there hasn’t been a […]

Read the full article →

Mobile Device Detection on a Web Site

March 26, 2012

Lately I’ve needed to find out how the person is viewing my pages. Now, in WordPress there’s a cool plugin called WPTouch that does all this for me. But when I’m not using WordPress then what do I do? Enter the script below. It detects about 90+% of the mobile devices out there and then […]

Read the full article →

WordPress Tips For All at WordCamp San Diego 2012

March 25, 2012

Yesterday I spent the day talking and learning with the WordPress community at WordCamp San Diego 2012. In short, it was pretty awesome. A day packed full of what I like to call “The fast track to WordPress knowledge.” See, you can go out an buy a book on WordPress…but it’ll likely be too general […]

Read the full article →

Why I Don’t Develop Using HTML5 and CSS3

March 23, 2011

Technology is awesome. It moves really fast and sometimes it can be quite difficult to keep up with the latest trends. Some ideas come and go so fast that you didn’t even know about it until it’s dead. HTML5 is not one of those things. HTML5, and CSS3, are here to stay and they’re awesome. […]

Read the full article →

Usability. You need to care about it.

October 29, 2010

I was recently involved in a project consisting of a group of websites. There is one big player who’s in charge of several franchises of the same business. Each one of the businesses has its own manager in charge of it. The job was to create a site for each individual business that would display […]

Read the full article →