Wordpress

Countdown Timer v1.95 Technical Preview

Okay folks, this is a technical preview of version 2.0 of the Countdown Timer.

The biggest change is that timers can now countdown automagically with JavaScript. Now, a word on the JS. This is the first version and there are only two modes: on and off. That means that you can’t change the format of the Javascript countdown (it will always display the years, months, days, hours, minutes, and seconds). I’m working on an elegant solution to this problem and would welcome any code, comments, suggestions, feedback, etc.

Other updates include:

  • Tabbed $afdnOptions array to make it more readable
  • Fixed strtotime typo
  • Brought time display inline with current WordPress practice. This fixes the dreaded timezone glitch.
  • Strip non-sig zeros option added
  • Fixed bug where “No dates present” would _not_ show if the data was returned instead of echo’d

In terms of stability, everything seems fine; I am currently using this Technical Preview on AFdN.

Download the file and try the goodness

0

Updates to AFdN

WordPress 2.3 was released earlier today (i.e Monday) and I spent some quality time backing up and then upgrading to that. I also upgraded and purged a bunch of the plugins and upgraded the theme to it’s latest version (which now supports widgets).

The biggest thing is the addition of Tags, which are kind of like keywords. It’s going to be interesting to get used to them, but it should be fun.

0

Adding User Photo to WordPress User Profile

I finally got around to packaging up the Add User Photo plugin. You can download it here. Go to the plugin page, Add User Photo, to grab the latest copy. Unzip it and upload to your plugins directory, and then activate it. You also need to modify line 21 of /wp-admin/profile.php, adding enctype="multipart/form-data" to the form tag.

So at the end of the day, line 21 should look like:

<form name="profile" id="your-profile" action="profile-update.php" method="post" enctype="multipart/form-data">
0

Add Data to User Field in WordPress

My solution to:
Add Custom Fields to User Profile & Registration Pages
http://wordpress.org/support/topic/55434

Copy and paste this into a php file in your plugins directory. I’ll get a file you can download setup shortly.

Update: Here download it => here.

<?php
/*
Plugin Name: Add To User
Plugin URI: https://www.andrewferguson.net/wordpress-plugins/
Plugin Description: Allows adding mySQL Data fields to store/add more user info
Version: 0.1
Author: Andrew Ferguson
Author URI: https://www.andrewferguson.net/
*/

/*Use: Allows adding mySQL Data fields to store/add more user info
/*


Add To User - Allows adding mySQL Data fields to store/add more user info
Copyright (c) 2006 Andrew Ferguson

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

*/ 
$fergcorp_addField = array(
				array(	"legend"=>"Favorite ColorLegend",
						"description"=>"What is your favorite color:",
						"label"=>"Color",
						"inputName"=>"wp_favColor",
						"inputType"=>"text",
						)
			);

add_action('show_user_profile', 'fergcorp_addToUser_addFields');
add_action('personal_options_update', 'fergcorp_addToUser_updateFields');

function fergcorp_addToUser_addFields(){ 
	global $wpdb, $user_ID, $fergcorp_addField;
	
	foreach($fergcorp_addField as $thisField){
		?>
		
		<fieldset>
		<legend><?php _e($thisField['legend']); ?></legend>
		<p class="desc"><?php _e($thisField['description']); ?></em></p>
		<p><label><?php _e($thisField['label']); ?><br />
		<input name="<?php echo $thisField['inputName']; ?>" type="<?php echo $thisField['inputType']; ?>" value="<?php echo $wpdb->get_var("SELECT ".$thisField["inputName"]." FROM $wpdb->users WHERE ID = ".$user_ID." LIMIT 1"); ?>" />
		</label></p>
		</fieldset>
		<? 
	}
		
		}

function fergcorp_addToUser_updateFields(){
	global $wpdb, $current_user, $fergcorp_addField;

	foreach($fergcorp_addField as $thisField){
		$wpdb->query("UPDATE $wpdb->users SET ".$thisField["inputName"]." = '".$_POST[$thisField["inputName"]]."' WHERE ID = ".	$current_user->id." LIMIT 1");
	}
}	


?>

Notes:
This is a very alpha version. It works and you shouldn’t have any issues with it. You’ll need to manually add the field to your wp_users table. I will fix that in a future release. The data is set via an array within an array. To add another data field, just add a second array within the first. Again, I’ll make that more user friendly in a future release.

0