My latest tweet: Aaron and my bike trailer in progress http://twitgoo.com/1gncq1 2010-08-07

I was googling around looking for info about changing the default image upload directory as well as the reason why the WordPress developers removed this once inherit feature. I didn’t find much.

I just hacked the config file (wp-config.php) to define the uploads directory by adding this line of code:

define('UPLOADS','images');

Th admin function that executes the upload looks for this definition at line 840 of the wp-includes/functions-post.php file.

You can insert whatever directory you’d like to use for images in place of ‘images’ in the code above starting of course from the root directory where WordPress is displayed.

I also stumbled upon this plugin that restores the WordPress 1.5+ upload options in the admin area:

Seems like it would have been beneficial to keep those options in tact since many many WP users are going to be upgrading. I’m sure that in a good number of cases, users will have setup a different images directory because of the use of WYSIWYG plugins or otherwise.

I’m definately loving the ability to resize the editing box, though.

Crunching and Launching

December 20th, 2005

Oooieee. I’m psyched to wrap something up, and something that I’ve been excited to work on (with the typical downtime in this particularly dark era of the year).

Loving the progress and completion that’s been happening recently – C gave 120% so kindly and generously to the seasonal cause of good will toward all. And got a 5 spot in return. But that’s what makes her so awesome.

Ars so generously cured me of my automotive woes for the time being, donating her downtime to my uptime.

Art and I laid down a girthy amount of audio as well as a sound way to go head-to-head with time.

Mas sent up a shipment of warm and soft goods. I can’t thank her enough for everything.

Off to Market Basket for Talapia and such.

So quoth* the venerable Arthur Mullen:

Remarkable coincidence to the black box inside my brainbox that in the human ocean two beings can find themselves riding the same rails twice. But then my brain is a recrafted graft made of cartiledge from my butt.

Amen.

* An excellent Scrabble word, one of the very few that contains a disclaimer about it’s stag lifestyle in the online version of the Official Hasbro Scrabble Dictionary:

QUOTH is the only accepted form of this verb; it cannot be conjugated

Woah. Coke BLAK!

December 12th, 2005

Apparently Coke is releasing a new beverage that combines regular Coke with coffee!

Here us the official Coke press release about it.

Coca-Cola Bl?k is an invigorating and stimulating blend that has a perfect balance of the effervescent taste sensation of Coca-Cola and natural flavors, with real coffee. The lightly carbonated, mid-calorie beverage, which is designed to appeal to adult consumers, is yet another example how The Coca-Cola Company reaches out to new audiences and addresses new beverage occasions.

Word Wars

December 7th, 2005

Word Wars

I highly recommend it.

Coming up at okPublic

December 5th, 2005

Here is a snapshot of a redesign for okPublic that I’ve been working on. I’m going for a softer and more ‘humane’ look. I know that this is what I would like in my hosting company and I think that going down this path with distinguish us from the rest.

I know the picture is fuzzy, but do drop a comment if you have any thoughts on the direction.

Snapshot of redesign of okPublic

Also, Nils – a member of okPublic and web craftsman – is helping out with the development. Check his stuff out at The Swede. I’m loving his layout for the BU Video Game Society.

Stepping Back to the Plate

December 5th, 2005

Wuhf! Been awhile. I got trapped in a time warp of sorts.

I think these motivational messages that were on the wall at the Bickford’s that C and I visited Friday night pulled me out of it.

One went something like this:

You are born with nothing. Everything that you gain after that is profit.

The other one went something like this:

To err is human. To admit to your mistakes is superhuman.

Needed to kill the dashboard in WordPress so it doesn’t clutter the admin section for users. Found a simple fix here:

how to remove the dashboard? (or go directly to other page) « WordPress Support

Here is the fix, which is made on line 7 of the file wp-admin/menu.php:

$menu[0] = array(__('Dashboard'), 1, 'index.php');

instead of

$menu[0] = array(__('Dashboard'), 0, 'index.php');

It is then necessary to edit the edit the file wp-login.php:

change line 159 from
$redirect_to = 'wp-admin/';

to

$redirect_to = 'wp-admin/post.php';

I’m in the midst of modding WordPress to act like a CMS for a site that I’m building. I wanted users of the same level to be able to edit pages. By changing line 20 in the admin/edit-pages.php file, it worked like a charm.

The original line looked like this:

AND ($wpdb->users.user_level < = $user_level OR $wpdb->posts.post_author = $user_ID)

I simply shifed the user_level check to allow page edits on pages that were created by users with levels either less than or equal to the active user’s level. New code looks like this:

AND ($wpdb->users.user_level < = $user_level OR $wpdb->posts.post_author = $user_ID)

At work I needed the following feature for a site:

A user can submit his/her email address via a form and, upon doing so, the email would be stored in a file with the email addresses of all of the other users that submitted their emails. The company wanted it’s visitors to be able to recieve a notification when the new site was launched.

I started by making the form, which ended up looking like this. I decided to echo the form info through PHP, so once the user submitted his/her email address, they would recieve a confirmation message. You’ll see what I mean as we go along.

So here’s the form, echoed:

$out= "Our new and more comprehensive site will be launched shortly.

Please submit your email address if you would like to be notified when it is launched.

“;
Notice I posted to self (sometimes I’m lazy and just drop in the page instead of the PHP server request self page call) and the name of the form and submit is “addemail”.

Next I setup an if command in the page to look for the form submission:

//check to see if email address was submitted

if ($_POST["addemail"]) {

If the email address was submitted, we want to grab with the REQUEST call. We also want to append it with a line breaks to put it on the next line, hence the “\r\n”:

//get the emailaddress

$emailaddress = $_REQUEST["emailaddress"] . “\r\n”;

//open file (in this case called “emails.txt”) to write email to it.

$myFile = “emails.txt”;

//first read the content so we can append
$fR = fopen($myFile, ‘r’) or die(“can’t open file”);
$fcontent = fread($fR, filesize(“emails.txt”));

//output new content with appended email address
$newcontent = $fcontent . $emailaddress;

$fh = fopen($myFile, ‘w’) or die(“can’t open file”);

fwrite($fh, “$newcontent”);
fclose($fh);

//send message to let them know their email address has been added

$out = “Thank you for your interest. You will be contacted in the coming weeks when the new site launches.”;

} else {

//if there was nothing posted, we prepare default display for output.

$out= “Our new and more comprehensive site will be launched shortly.
Please submit your email address if you would like to be notified when it is launched.

“;

}

?>
Then all we have to do is place the content somewhere within the page with this code:


< ?php echo "$out"; ?>

Done!