Categories
General

flickpress 0.6

No, that’s not a typo…I’ve decided to rename my Flickr plugin. There’s an old WP plugin out there in the aether that’s got the old name, so a new name seemed like a good idea, especially if I’m going to post it at wordpress.org sometime.

The more exciting change in this version is that it uses ThickBox for the popup tool now, rather than the old ugly popup method. I think there were some advantages to the old way, but there’s a lot of peer pressure to use ThickBox or something like it. There’s also a new icon, but I’m not crazy about how it turned out, so I probably shouldn’t mention it.

Since this version involves a renaming you’ll want to deactivate the old version, delete the old folder in your plugins folder, then install the new version as usual. You’ll also need to re-enter your Flickr API key, and reactivate and reconfigure the widget if you’re using it.

If you’re reading this and still aren’t sure what the flickpress plugin does, it’s a simple plugin that makes it easy to insert photos from Flickr into your WordPress posts. It can access several different Flickr accounts, so it’s great for group blogs.

Download flickpress 0.6: flickpress_0.6.zip

Categories
General

OrgPress Theme 0.2

This version adds the quick posting thing I mentioned in an earlier post, with some tweaks based on how it’s been working at my group blog. It’s fun and popular, but we decided to keep the quick posts separate from the regular posts, putting them in a sidebar block instead. Not much else has changed – just a couple of fixes to the archives.

Download OrgPress 0.2: orgpress_0.2.zip

Categories
General

Adding a quick post box to your theme

Since I added a sidebar login form to my group blog, I’ve wanted to add a way for logged-in folks to make a quick post without going to the WordPress backend. I learned about the Prologue theme via a Twitter post about its successor, P2. There’s a comment at Lorelle’s blog pointing to where to get P2 via SVN, but it’s pretty complicated AJAX-y and JSON-y stuff – the original Prologue looked much easier to borrow from.

First, you’ll need the post form. You can put the form directly in your index.php, or it in a separate file (I called it post-form.php):

<?php $user = get_userdata( $current_user->ID ); ?>

<div id="postbox">
<h3><a class="togglepost" style="cursor:pointer">Make a quick post &raquo;</a></h3>
<div class="showhidepost">
<form id="new_post" name="new_post" method="post" action="<?php bloginfo( 'url' ); ?>/">
<input type="hidden" name="action" value="post" />
<?php wp_nonce_field( 'new-post' ); ?>
<textarea name="posttext" id="posttext" style="width: 100%;"></textarea><br />
<strong>Title:</strong> <input size="40" type="text" name="posttitle" id="posttitle" /> <input id="submit" type="submit" value="Post it &raquo;" />
</form>
</div>
</div>

Next, add code to detect a logged-in user with publishing permission, and either include the form or echo it out:

if( current_user_can( 'publish_posts' ) ) {
require_once dirname( __FILE__ ) . '/post-form.php';
}

Finally, add some code to your index.php to process submitted posts:

if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'post' ) {
if ( ! is_user_logged_in() )
auth_redirect();
if( !current_user_can( 'publish_posts' ) ) {
wp_redirect( get_bloginfo( 'url' ) . '/' );
exit;
}
check_admin_referer( 'new-post' );
$user_id = $current_user->user_id;
$post_content = $_POST['posttext'];
$post_title = $_POST['posttitle'];
$post_id = wp_insert_post( array(
'post_author' => $user_id,
'post_title' => $post_title,
'post_content' => $post_content,
'post_status' => 'publish'
) );
wp_redirect( get_bloginfo( 'url' ) . '/' );
exit;
}

Prologue has a tags field, which I replaced with a title field – it’d be easy to add any of the fields from the backend posting form you think are important. It might also be interesting to make a template for a quick post page separate from the main blog, like a bulletin board. I think for that I’d put back Prologue’s auto-title feature, and add a hidden category field to make it easy to filter quick posts off the main blog.

Categories
General

Kitchen sink soup

Kitchen sink soup #2

When you’ve just eaten a chicken and you’re getting sleepy, take a couple of minutes before getting out that tub of ice cream to put the remaining parts of the chicken – it’s soul really – into your favorite leftover repository. Then you can make soup the next day, making the $15 you spent to get that organic, free range, kosher chicken a little closer to worth it.

Ingredients:

  • chicken stock
  • a bunch of vegetables, such as carrots, onion, celery, beets, cabbage, leeks, bell pepper, collard greens, etc.
  • bacon

Start by making some chicken stock from the remains of that poor chicken – simmer whatever was left in some water with maybe some onion, carrot, celery, peppercorns, allspice, and thyme. Simmer for around 1/2 hour, probably over low heat, but it depends on your stove. Once that’s been going for a few minutes you can start softening the vegetables. Ideally, you had bacon for breakfast and left the pan dirty – if so, use that pan! Pretty much any vegetables will do, but I think chicken soup should at least contain onion, carrot, and celery. And more bacon. Once the vegetables are soft, pour in the stock. If there’s chicken left on the bones you can throw that in the soup too once it’s cool enough to pull off the bones. Do some tasting to check for saltiness. Some vinegar or lemon juice will add a lot of flavor if you’re avoiding salt. To make my soup even more likely to be accepted as dinner, I added some cooked lentils and garnished with creme fraiche and cheese.

Categories
General

WP-Polls for non-admins

WP-Polls is a nice plugin that lets you add polls to your WordPress site, either in posts, pages, or in your sidebar via a widget. For some (probably logical) reason, the author decided to hard-code the WordPress role allowed to manage polls to the administrator. I’d rather let my blog users set up their own polls – maybe they’ll manage to blow up something by being able to, but I doubt it. Here’s how to allow a non-admin roles to manage polls:

  1. Search for “administrator” in wp-polls.php.
  2. Replace it with the desired role – such as “editor” or “author”.
  3. Deactivate and reactivate the plugin.

Keep in mind that you’ll need to re-do this each time you update the plugin…unless/until the plugin author decides to add an admin Settings page to do this.