Chomper Stomping jQuery/JavaScript/CSS 3/HTML 5, Java/PHP/Python/ActionScript, Git, Chrome/Firefox Extensions, Wordpress/Game/iPhone App Development and other random techie tidbits I've collected

30Dec/110

WP phpBB Bridge: Warning: mysql_set_charset() expects parameter 2 to be resource, boolean given

mysqlerror

Warning: mysql_set_charset() expects parameter 2 to be resource, boolean given in wp-content/plugins/wp-phpbb-bridge/inc/widgets/wpbb_topics_widget.php on line 149

This is an error caused by the fact that the WP phpBB Bridge plugin is naively written in places.

For instance, in this case the plugin authors don't expect you to be using a socket instead of a port. Looking at the documentation for mysql-pconnect you see that you can either use combination of hostname:port or hostname:socket. Since they are pulling the setup info straight from the phpBB config file, you have little to no control over the values there (especially if already configured).

What they ought to do is check to see if $port isset() && !empt() and only then append the ":" . $port. But instead, they tag on ":" to your db host EVERY TIME. This breaks your setup if you host is defined in phpBB with a socket. Most of what I just said sort of sounds like gibberish even to me, so, basically, if you are getting this error, the problem is actually line 147. Replace the current line 147 with this:

14Dec/115

Events Calendar Pro Nav Formatting Messed up on Empty Calendar

The Events Calendar Pro (from http://tri.be/) has a few problems.

If you are trying to figure out why a calendar with no events in that month has completely screwed up header navigation, just put this line of code inside of table.php in the top of the display_day function (put it directly before the for loop):

$thisisherebecausethispluginSUCKSdontremoveit = has_excerpt() ? TribeEvents::truncate($post->post_excerpt) : TribeEvents::truncate(get_the_content(), 30);

This basically just runs some "truncate" function on the "TribeEvents" object. For some reason this truncate function magically fixes the header nav display issues.

23Nov/110

WordPress Settings API – Adding Options to Existing Page

blue-xl

Adding new options to an existing page in the dashboard in wordpress can be maddening. I've literally spent 15+ hours dealing with this horrible API at this point. To the point where I wrote two different wrappers for it.

Here are some notes chiseled along the way for any poor soul following me down this obtuse path.

Today I'll focus on adding options to an existing page. Hopefully soon I'll do one on making a new page.

Checklist/Overview:
1. Hook into the admin init action (add_action('admin_init'))
2. Create your section (add_settings_section)
3. Output hidden fields so settings will save (settings_fields)
4. Create your fields (add_settings_field and register_setting)

Your options will be available through the usual "get_option" means...

Step 1) Hook into the admin init action:

Step 2) Create your init function (that you just hooked into the admin_init action):

Step 3) Create your own section register API

Step 4) Create your section callback functions

It is really annoying that the API doesn't allow you to pass params to this callback function, which means you have to define each one individually...

Step 5) Create your own field register API

Step 6) Create your global callback function

Step 7) Register your section(s)

This goes in that init function you made in step 2

Step 8) Register your field(s)

This goes in that init function you made in step 2

Here's an example of a completed version of all this. This one adds a crap ton of custom thumbnail size options to the media panel. It is a really bad example as it is overly complex:

22Oct/110

Teaser of things to come…

custom_ratings

Lots going on at ChomperStomp right now.

I've been up to my eyeballs in work and in babies (3 month old and 2.5 year old).

Here's a little teaser for something big I'm working on:
User Ratings!
User Ratings, hearts AND stars!
User Ratings, OPTIONS!!!!
User Ratings!

That's right, custom user ratings in Continuum Coming November 1st! (will require either Continuum 1.9 or Continuum Refactor 11.1101, both coming 11/01/11)

Haven't settled on the price yet, probably between $50 and $100 depending on how much longer it takes...