WordPress: insert a user into the database

WordPress stores all user data in two tables, namely wp_users and wp_user_meta. If you've ever tried to insert a new user in the database, you've surely stumbled on some WordPress error while trying to display user preferences or profiles. The point is that both tables work together, so that if you fail to specify some data in one of these tables, you'll get an error. Fortunately, there's a solution.

jQuery: serialize elements outside forms

A good question today from Stack Overflow: how can we serialize an element which is not a form? jQuery provides the serialize() and serializeArray() methods that operate on forms by turning attributes and values into properties and values of a returned JSON object (the latter) or by building a standard query string (the former). However, creating a JSON object from an element is quite simple. Let's see why.

Coding doubts: what clients should know

Web projects fail not because they're poorly coded, but because our clients are full of doubts about the overall goal they want to achieve. Generally speaking, clients know only how a web site should look like, not how it should work. Information architecture, usability and SEO are the big taboos for them. Clients often ask to change the visual layout of a page or to add a new feature to the web site. They give us some PSD files, a couple of documents and images and they think it's all set and ready to be launched online. But they are not aware of the implications of what they're publishing. No briefing, no analysis, no brainstorming and no planning. Therefore a web developer should be an IA expert, a usability tester and a project manager, all in one (person). Too bad.

jQuery: password strength checker

We can use JavaScript regular expressions together with jQuery to create a simple plugin that checks the strength of a user-defined password. The concept behind is quite simple: every time a user types a character in the input field, the value inserted is compared against the corresponding regular expression. Passwords can be medium, weak or strong in terms of strength. Strength doesn't depend on the number of characters inserted, but on the combination of letters, digits and special characters. Let's see the details.

WordPress: display images from custom fields

A couple of weeks ago I finished a WordPress project which consists of a jQuery slot machine product slideshow. The problem with this plugin was to allow the administrator to insert all the required images and captions in order to make the slideshow work. For that reason, I used WordPress custom fields. The tricky part is to fetch the images attached via custom fields. Let's see how.

jQuery: smart Lavalamp menu plugin

Yesterday a friend of mine was in trouble because he desperately needed to create a jQuery Lavalamp menu for a client featuring some peculiar characteristics, such as the ability to start from the current page item and an intelligent movement sensor which allows the cursor to stay on the last selected item. I created for him a simple jQuery plugin that performs all these tasks. Let's see the details.

Integrating jQuery plugins in WordPress

One of the most frequently asked questions on forums, blogs and mailing lists concerns the integration of jQuery plugins with WordPress. Integrating jQuery plugins with WordPress is not a matter of queuing scripts only, but it also means understanding the correct hierarchy and order by which scripts are executed within WordPress. Let's see the details of this topic.