示例#1
0
/**
 * Change password form fields.
 *
 * @since 0.0.1
 */
function vp_change_password_form_fields()
{
    ob_start();
    if (isset($_POST['action']) && 'vp_change_password' == $_POST['action']) {
        vp_error_messages();
    }
    if (isset($_GET['cp']) && 'true' == $_GET['cp']) {
        ?>
<div class="form-message success">
  <p><?php 
        _e('Your password is changed, and your are now signed in with your new password.', 'v2press');
        ?>
</p>
</div>
<?php 
    }
    ?>
<p class="fade xsmall bold"><?php 
    _e('If you don\'t want to change password, please don\'t enter either of the three fields following.', 'v2press');
    ?>
</p>
<form id="change-password-form" method="post" action="#change-password-box">
  <fieldset>
    <p>
      <label for="vp_current_password"><?php 
    _e('Current Password', 'v2press');
    ?>
</label>
      <input type="password" autocomplete="off" name="vp_current_password" id="vp_current_password" class="form-field required" value="" />
    </p>
    <p>
      <label for="vp_new_password"><?php 
    _e('New Password', 'v2press');
    ?>
</label>
      <input type="password" autocomplete="off" name="vp_new_password" id="vp_new_password" class="form-field required" value="" />
    </p>
    <p>
      <label for="vp_new_password_confirmation"><?php 
    _e('Password Again', 'v2press');
    ?>
</label>
      <input type="password" autocomplete="off" name="vp_new_password_confirmation" id="vp_new_password_confirmation" class="form-field required" value="" />
    </p>
    <p>
      <input type="hidden" name="vp_change_password_nonce" value="<?php 
    echo wp_create_nonce('vp-change-password-nonce');
    ?>
" />
      <input type="hidden" name="action" value="vp_change_password" />
      <input type="submit" class="btn push-right" value="<?php 
    _e('Change Password', 'v2press');
    ?>
" />
    </p>
  </fieldset>
</form>
<?php 
    return ob_get_clean();
}
示例#2
0
/**
 * The edit topic form.
 *
 * @since 0.0.1
 */
function vp_edit_topic_form()
{
    $pub_time = get_the_time('U');
    $time_diff = abs(current_time('timestamp') - $pub_time);
    // Cannot edit topic 15mins after created
    if (900 < $time_diff) {
        echo '<p>' . __('You cannot edt this topic 15 minites after created.', 'v2press') . '</p>';
        return;
    }
    ob_start();
    $topic_id = get_query_var('p');
    $topic = get_post($topic_id);
    vp_error_messages();
    ?>
<form id="vp-edit-topic" action="" method="post">
    <fieldset>
        <p><input type="text" name="topic_title" id="topic_title" class="form-field wider" value="<?php 
    echo $topic->post_title;
    ?>
" /></p>
        <p><textarea name="topic_content_filtered" id="topic_content_filtered" class="form-field wider" rows="10" cols="20" ><?php 
    echo $topic->post_content_filtered;
    ?>
</textarea></p>
        <p>
            <input type="hidden" name="action" value="edit_topic" />
            <input type="hidden" name="edit_topic_nonce" value="<?php 
    echo wp_create_nonce('edit-topic-nonce');
    ?>
" />
            <input type="submit" name="submit" class="btn" value="<?php 
    _e('Submit Changes', 'v2press');
    ?>
" />
        </p>
    </fieldset>
</form>
<?php 
    echo ob_get_clean();
}