Skip past navigation, straight to the content

Category Archives: Projects

Various projects undertaken by Filipe Fortes.

Updating WordPress Plugins for 1.5.1

Those who have upgraded to WordPress 1.5.1 have noticed that the upgrade broke a few plugins, such as Post Levels.

This was due to some changes in the WordPress architecture that allow plugin developers to replace some of the core functions in WordPress. However, this means that those functions will not be available when your plugin gets loaded. The functions are now defined in wp-includes/pluggable-functions.php, as of 1.5.1 the following functions are pluggable:

  • get_currentuserinfo
  • get_userdata
  • get_userdatabylogin
  • wp_mail
  • wp_login
  • auth_redirect
  • wp_redirect
  • wp_setcookie
  • wp_clearcookie
  • wp_notify_postauthor
  • wp_notify_moderator

Plugins that depend on any of the above functions need to make sure all uses of the function occur after all plugins have loaded. This is only an issue for code that is executed when the plugin is initialized (as opposed to code that is hooked into an action or filter). Initialization code should be refactored to run after WordPress has initliazed, as in the sample below:

// Run setup after the pluggable functions have loaded
add_action('init', 'myplugin_setup')

function myplugin_setup()
{
  // Code lives here
}

Alternatively, you can hook into plugins_loaded, which is also executed after the pluggable functions have loaded.

Post Levels plugin v0.2.1

Version 0.2 of the Post Levels plugin has been released. This release makes the plugin compatible with WordPress 1.5.1. There are no new features in this release.

Download

Post Levels Plugin v0.2.1

Update 5/22: Sigh, as mentioned in the comments, single-post view is broken. This is due to an issue in WordPress that I unfortunately cannot change within a plugin. I’ve filed a bug; in the meanwhile, I recommend staying on 1.5 until this (and other) issues (hopefully) get fixed in 1.5.1.1

Post Levels plugin v0.2

Version 0.2 of the Post Levels plugin has been released.

Changes:

Two new functions were added:

  • is_private: Returns true if the current post is private (this follows the same model as the other “is” functions)
  • is_post_level($level): Returns true if the current post’s level is equal to $level, which defaults to 0

Download

Post Levels Plugin v0.2

Install

Installation instructions

Using the New Functions

An example for using the is_private() function is shown below:

<?php if (function_exists('is_private') && is_private()) : ?>
  <span class="private">(private)</span>
<?php endif;?>

It is good style to check if the function exists before calling, in case the plugin is disabled for some reason.

Do you want RSS for private posts?

Does any one reading this want me to enable private posts within the RSS feed? I can make it happen, but it’ll take a little bit of work and debugging (unfortunately, I cannot accomplish everything within a Wordpress plugin). I need to know if anyone would actually use this functionality before implementing it.

Some notes:

  • Your aggregator must support HTTP authentication: The popular ones do
  • Private posts will not contain full content: They’ll only contain the title of the post. You’ll have to visit the site (and be logged in) to read the post

Introducing the Post Levels plugin

Post Levels is a Wordpress plugin which allows you to restrict access to posts based upon the user level. Wordpress 1.3/1.5 or greater required.

Version 0.1 is available for download: Post Levels Plugin v0.1

Install

  1. Save the post-levels.php.txt as post-levels.php file to your wp-content/plugins/ directory
  2. Activate the plugin within Wordpress in the Plugins section

Use

  1. Set the Post Status to Private: This ensures your post will not be shown if the plugin is accidentally disabled
  2. Add a Custom Field named post_level
  3. Set the value of post_level to a number between 1 and 10: Only registered users with a level greater than or equal to the post_level will be able to see your post.

Known Issues

  • Archive and Category Post listings do not include private posts

New and Improved?

It wasn’t worth the wait, but the new fortes.com has finally arrived. Please, make yourself at home.

I’m trying to kick my perfectionist’s paralyzation, so not everything here is complete … more with time.

Metadex Update

I’m not sure why, but I made a quick update to the neglected Metadex today (which has been active for almost 11 months).

  • A new index: BlogPulse
  • Better (but still primitive) duplicate detection. If you check today’s index, you’ll notice the number three result has two scores from Daypop (this is one of the original reasons I created Metadex).

If you happen to use the site, let me know if you have any issues or requests, and I’ll take care of them sometime next year.

Slowly but surely

Things are starting to look a little better around here. Design and readibility has improved from horrendous to ugly. I’ll fix that all later.

Astute readers may notice this page now sports login and password fields. Why is having an account cool?

  • Private Content: Many posts are not visible unless you’re logged in; even if you’re logged in, some posts are still hidden from you as well (depending on how private the subject matter is). Some posts are only visible to me (only the funny ones).
  • Non-Anonymous Comments: This isn’t really that cool.
  • (Under Debate) Posting: Some users may be allowed to post links, etc

Email me and I will set you up with an account. If you don’t know my email, then you don’t deserve an account at this time (I’m still working out the kinks).

Coming soon:

  • RSS/Atom feeds with comments: Because I would demand it from others
  • Photos: I want to have these working before I leave for Portugal in two weeks

Rebirth

Yes, yes, finally. The webpage has returned, I manage to (kinda) keep my word.

It’ll be a little while before I get everything running smoothly (along with a design that doesn’t suck), so bear with me here.

Here is what is in store in the near future:

  • Photos: Yes, long awaited, they’ll finally come back, better than ever (by “ever” I mean “non-existant”)
  • User Registration: Most content will not be visible unless you have been given an account and are logged in. My Beanie Baby fetish must remain secret.
  • Non-Ugly Design: Something readable, perhaps.

Southside Bar Map

You can download the map here: SouthsideMap.pdf

Note: The document will probably look terrible on screen, but it prints out fine. This is a font issue, and I’m not quite sure how to resolve it.

Blockmaker

Launch the Block Maker.

The New Tetris is a highly addictive game for the Nintendo 64. On the surface, The New Tetris isn’t much different from it’s classic ancestor. One minor change, the introduction of Silver and Gold Blocks (alternatively: Multi and Mono-Squares), radically changes the game strategy for advanced players.

A “Silver Block” (also known as “Multi-Square”) is a 4×4 square formed by different shapes. When you create a Silver Block, its pieces glue together and turn silver. You receive five bonus lines for each line of a Silver Block you clear.

A “Golden Block” (a.k.a. “Mono-Square”) is a 4×4 square formed with four pieces of the same shape. This Golden Block gives you ten bonus lines for each of its lines you clear.

With the significant bonuses given by Silver and Gold blocks, an advanced player’s strategy shifts from creating a Tetris (clearning four lines at once) to creating Gold and Silver blocks.

One problem that novices have when trying to create blocks is a failure to realize that there are many different ways to create blocks. I created the Block Maker as a cheat sheet for novices, who are trying to learn how to construct blocks.

The Block Maker is easy to use, simply choose which four blocks you’re dealing with and you’ll see all the blocks you can create using those four pieces. Why Four? The game let’s you “look ahead” and see what the next three pieces are, combined with the current piece, makes four.

The Block Maker requires a browser which supports Frames and JavaScript. Most versions of Netscape and Internet Explorer should work fine (Disclaimer: I’ve only tested it on Internet Explorer 5 and Netscape 4 for Windows).

Launch the Block Maker.