Example #1
0
/**
 * Outputs the post form subscription checkbox.
 *
 * Checks if user is subscribed and outputs checkbox based on status.
 *
 * @since 1.1
 */
function bb_user_subscribe_checkbox($args = null)
{
    if (!bb_is_user_logged_in()) {
        return false;
    }
    $is_current = false;
    $defaults = array('tab' => false);
    $args = wp_parse_args($args, $defaults);
    $tab = $args['tab'] !== false ? ' tabindex="' . $args['tab'] . '"' : '';
    $is_current = bb_get_user_id(get_post_author_id()) == bb_get_current_user_info('id');
    // Change subscription checkbox message if current or moderating
    if (bb_is_topic_edit() && !$is_current) {
        $text = __('This user should be notified of follow-up posts via email');
    } else {
        $text = __('Notify me of follow-up posts via email');
    }
    echo '
	<label for="subscription_checkbox">
		<input name="subscription_checkbox" id="subscription_checkbox" type="checkbox" value="subscribe" ' . checked(true, bb_is_user_subscribed(), false) . $tab . ' />
		' . apply_filters('bb_user_subscribe_checkbox_label', $text, (bool) $is_current) . '
	</label>';
}
function is_topic_edit()
{
    bb_log_deprecated('function', __FUNCTION__, 'bb_is_topic_edit');
    return bb_is_topic_edit();
}
<?php

// Setup $current_poster varaible on post edit
if (bb_is_topic_edit()) {
    foreach (array('post_author', 'post_email', 'post_url') as $post_author_meta) {
        $current_poster[$post_author_meta] = bb_get_post_meta($post_author_meta, $post_id);
    }
    // Shift $current_poster values from cookie
} else {
    $current_poster = bb_get_current_poster();
    $current_poster['post_email'] = $current_poster['post_author_email'];
    $current_poster['post_url'] = $current_poster['post_author_url'];
}
?>

	<p id="post-form-author-container">
		<label for="author"><?php 
_e('Author');
?>
			<input type="text" name="author" id="author" size="50" tabindex="30" aria-required="true" value="<?php 
echo esc_attr($current_poster['post_author']);
?>
" />
		</label>
	</p>

	<p id="post-form-email-container">
		<label for="email"><?php 
_e('Email');
?>
			<input type="text" name="email" id="email" size="50" tabindex="31" aria-required="true" value="<?php