Countdown Timer v1.91

Technically, this is a step back because I already released 1.95 as a Technical Preview. However, I wanted to fix a bug without having to release the incomplete features included in the 1.95 Technical Release. So this is a special release. This release fixes a bug where the widget wouldn’t save data. Baring any catastrophic bug discovery, this will be the last release before version 2.0 (which I hope to release over Christmas Break).

Read more or download it!

Force User Field Registration v0.5

A real update this time! Version 0.5 of Force User Field Registration finally includes that back end I’ve been promising to put in. This should make it pretty easy to use now. I also updated some of the code to take advantage of some already established WordPress functions.

Read more or download it!

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

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: http://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: http://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.