Initial functionality so level 1 users may be allowed to publish or just post drafts.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-09-14 12:41:09 +00:00
parent ec9cd4e395
commit fc0583beab
5 changed files with 38 additions and 33 deletions

View File

@ -65,7 +65,10 @@ window.onload = focusit;
<fieldset id="poststatusdiv">
<legend><a href="http://wordpress.org/docs/reference/post/#post_status" title="<?php _e('Help on post status') ?>"><?php _e('Post Status') ?></a></legend>
<div><label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post_status, 'publish'); ?> /> <?php _e('Publish') ?></label>
<div>
<?php if ( 2 == get_option('new_users_can_blog') && 1 != $user_level ) : ?>
<label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post_status, 'publish'); ?> /> <?php _e('Publish') ?></label>
<?php endif; ?>
<label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post_status, 'draft'); ?> /> <?php _e('Draft') ?></label>
<label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post_status, 'private'); ?> /> <?php _e('Private') ?></label></div>
</fieldset>
@ -142,7 +145,9 @@ if ($action != 'editcomment') {
<?php
if ('publish' != $post_status || 0 == $post_ID) {
?>
<?php if ( 2 == get_option('new_users_can_blog') && 1 != $user_level ) : ?>
<input name="publish" type="submit" id="publish" tabindex="10" value="<?php _e('Publish') ?>" />
<?php endif; ?>
<?php
}
?>

View File

@ -1,29 +1,13 @@
<div class="wrap">
<?php
$form_action = 'post';
$form_extra = '';
$form_pingback = '<input type="hidden" name="post_pingback" value="1" id="post_pingback" />';
$form_trackback = '<p><label for="trackback">' . sprintf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Identifier">URI</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Identifier">URI</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') .
'<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>';
$saveasdraft = '';
?>
<form name="post" action="post.php" method="post" id="simple">
<?php
if (isset($mode) && 'bookmarklet' == $mode) {
echo '<input type="hidden" name="mode" value="bookmarklet" />';
}
?>
<?php if (isset($mode) && 'bookmarklet' == $mode) : ?>
<input type="hidden" name="mode" value="bookmarklet" />
<?php endif; ?>
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' />
<input type="hidden" name="action" value='post' />
<script type="text/javascript">
<!--
@ -66,18 +50,26 @@ edCanvas = document.getElementById('content');
//-->
</script>
<?php echo $form_pingback ?>
<?php echo $form_trackback; ?>
<input type="hidden" name="post_pingback" value="1" id="post_pingback" />
<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Identifier">URI</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Identifier">URI</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') ?>
<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>
<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" />
<input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
<input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
<?php if ( 1 < $user_level || (1 == $user_level && 2 == get_option('new_users_can_blog')) ) : ?>
<input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php _e('Publish') ?>" />
<?php if ('bookmarklet' != $mode) {
<?php endif; ?>
<?php if ('bookmarklet' != $mode) {
echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' . __('Advanced Editing &raquo;') . '" />';
} ?>
<input name="referredby" type="hidden" id="referredby" value="<?php if (isset($_SERVER['HTTP_REFERER'])) echo urlencode($_SERVER['HTTP_REFERER']); ?>" />
</p>
<?php do_action('edit_form', ''); ?>
<?php do_action('simple_edit_form', ''); ?>
</div>
</form>

View File

@ -47,7 +47,7 @@ include('options-head.php');
<h2><?php _e('General Options') ?></h2>
<form name="form1" method="post" action="options.php">
<input type="hidden" name="action" value="update" />
<input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="'blogname','blogdescription','siteurl','admin_email','users_can_register','new_users_can_blog','gmt_offset','date_format','time_format','home','start_of_week'" />
<input type="hidden" name="action" value="update" /> <input type="hidden" name="page_options" value="'blogname','blogdescription','siteurl','admin_email','users_can_register','gmt_offset','date_format','time_format','home','start_of_week'" />
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr valign="top">
<th width="33%" scope="row"><?php _e('Weblog title:') ?></th>
@ -78,10 +78,7 @@ include('options-head.php');
<td> <label for="users_can_register">
<input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_settings('users_can_register')); ?> />
<?php _e('Anyone can register') ?></label>
<br />
<label for="new_users_can_blog">
<input name="new_users_can_blog" type="checkbox" id="new_users_can_blog" value="1" <?php checked('1', get_settings('new_users_can_blog')); ?> />
<?php _e('Newly registered members can publish articles') ?> </label></td>
</td>
</tr>
</table>
<fieldset class="options">

View File

@ -48,7 +48,7 @@ include('options-head.php');
<h2>Writing Options</h2>
<form name="form1" method="post" action="options.php">
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="'default_post_edit_rows','use_smilies','use_balanceTags','advanced_edit','ping_sites','mailserver_url', 'mailserver_port','mailserver_login','mailserver_pass','default_category', 'default_email_category'" />
<input type="hidden" name="page_options" value="'default_post_edit_rows','use_smilies','use_balanceTags','advanced_edit','ping_sites','mailserver_url', 'mailserver_port','mailserver_login','mailserver_pass','default_category','default_email_category','new_users_can_blog'" />
<table width="100%" cellspacing="2" cellpadding="5" class="editform">
<tr valign="top">
<th scope="row"> <?php _e('When starting a post, show:') ?> </th>
@ -87,6 +87,11 @@ endforeach;
?>
</select></td>
</tr>
<th scope="row"><?php _e('Newly registered members:') ?></th>
<td> <label for="new_users_can_blog0"><input name="new_users_can_blog" id="new_users_can_blog0" type="radio" value="0" <?php checked('0', get_settings('new_users_can_blog')); ?> /> <?php _e('Cannot write articles') ?></label><br />
<label for="new_users_can_blog1"><input name="new_users_can_blog" id="new_users_can_blog1" type="radio" value="1" <?php checked('1', get_settings('new_users_can_blog')); ?> /> <?php _e('May submit drafts for review') ?></label><br />
<label for="new_users_can_blog2"><input name="new_users_can_blog" id="new_users_can_blog2" type="radio" value="2" <?php checked('2', get_settings('new_users_can_blog')); ?> /> <?php _e('May publish articles') ?></label><br /></td>
</tr>
</table>
<fieldset class="options">
<legend><?php _e('Update Services') ?></legend>
@ -129,7 +134,7 @@ endforeach;
?>
</select></td>
</tr>
</table>
</table>
</fieldset>
<p class="submit">
<input type="submit" name="Submit" value="<?php _e('Update Options') ?> &raquo;" />

View File

@ -66,6 +66,9 @@ case 'post':
$post_name = $_POST['post_name'];
if (empty($post_status)) $post_status = 'draft';
// Double-check
if ( 'publish' == $post_status && 1 == $user_level && 2 != get_option('new_users_can_blog') )
$post_status = 'draft';
$comment_status = $_POST['comment_status'];
if (empty($comment_status)) $comment_status = get_settings('default_comment_status');
$ping_status = $_POST['ping_status'];
@ -322,6 +325,9 @@ case 'editpost':
$trackback = preg_replace('|\s+|', '\n', $trackback);
if (isset($_POST['publish'])) $post_status = 'publish';
// Double-check
if ( 'publish' == $post_status && 1 == $user_level && 2 != get_option('new_users_can_blog') )
$post_status = 'draft';
if (($user_level > 4) && (!empty($_POST['edit_date']))) {
$aa = $_POST['aa'];