<?php
class ee_user_meta {
function ee_user_meta() {
if ( is_admin() )
{
add_action('show_user_profile', array(&$this,'action_show_user_profile'));
add_action('edit_user_profile', array(&$this,'action_show_user_profile'));
add_action('personal_options_update', array(&$this,'action_process_option_update'));
add_action('edit_user_profile_update', array(&$this,'action_process_option_update'));
}
}
function action_show_user_profile($user)
{
?>
<h3><?php _e('Other Contact Info') ?></h3>
<table>
<tr>
<th><label for="something"><?php _e('Something else'); ?></label></th>
<td>
<input type="checkbox" name="guest_author" value="guest_author" <?php if(get_the_author_meta('guest_author', $user->ID)=='guest_author') echo 'checked'; ?> /> Guest Author<br />
<input type="text" name="something" id="something" value="<?php echo esc_attr(get_the_author_meta('something', $user->ID) ); ?>" />
</td>
</tr>
</table>
<?php
}
function action_process_option_update($user_id)
{
update_usermeta($user_id, 'guest_author', ( isset($_POST['guest_author']) ? $_POST['guest_author'] : '' ) );
update_usermeta($user_id, 'something', ( isset($_POST['something']) ? $_POST['something'] : '' ) );
}
}
/* Initialise outselves */
add_action('plugins_loaded', create_function('','global $ee_user_meta_instance; $ee_user_meta_instance = new ee_user_meta();'));
?>