Changeset 2166
- Timestamp:
- 01/31/05 06:38:12 (4 years ago)
- Files:
-
- trunk/wp-admin/options-discussion.php (modified) (1 diff)
- trunk/wp-admin/options-general.php (modified) (2 diffs)
- trunk/wp-admin/profile.php (modified) (3 diffs)
- trunk/wp-admin/upgrade-schema.php (modified) (2 diffs)
- trunk/wp-comments-post.php (modified) (2 diffs)
- trunk/wp-content/themes/default/comments.php (modified) (3 diffs)
- trunk/wp-includes/comment-functions.php (modified) (2 diffs)
- trunk/wp-includes/functions-post.php (modified) (2 diffs)
- trunk/wp-includes/functions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/options-discussion.php
r2075 r2166 61 61 <fieldset class="options"> 62 62 <legend><?php _e('Before a comment appears:') ?></legend> 63 <ul> 64 <li> 63 <ul> 64 <li> 65 65 <label for="comment_moderation"> 66 66 <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_settings('comment_moderation')); ?> /> trunk/wp-admin/options-general.php
r1946 r2166 12 12 <form name="form1" method="post" action="options.php"> 13 13 <input type="hidden" name="action" value="update" /> 14 <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' " />14 <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','comment_registration'" /> 15 15 <table width="100%" cellspacing="2" cellpadding="5" class="editform"> 16 16 <tr valign="top"> … … 42 42 <td> <label for="users_can_register"> 43 43 <input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_settings('users_can_register')); ?> /> 44 <?php _e('Anyone can register') ?></label> 44 <?php _e('Anyone can register') ?></label><br /> 45 <label for="comment_registration"> 46 <input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_settings('comment_registration')); ?> /> 47 <?php _e('Users must be registered and logged in to comment') ?> 48 </label> 45 49 </td> 46 50 </tr> trunk/wp-admin/profile.php
r2107 r2166 139 139 </p> 140 140 141 <table width="99%" border="0" cellspacing="2" cellpadding="3" >141 <table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform"> 142 142 <tr> 143 143 <th width="33%" scope="row"><?php _e('Login:') ?></th> … … 164 164 </tr> 165 165 <tr> 166 <th scope="row"><?php _e('Profile:') ?></th>167 <td><textarea name="user_description" rows="5" id="textarea2" style="width: 99%; "><?php echo $profiledata->user_description ?></textarea></td>168 </tr>169 <tr>170 166 <th scope="row"><?php _e('Nickname:') ?></th> 171 167 <td><input type="text" name="newuser_nickname" id="newuser_nickname2" value="<?php echo $profiledata->user_nickname ?>" /></td> 172 168 </tr> 173 169 <tr> 174 <th scope="row"><?php _e('E-mail:') ?></th> 175 <td><input type="text" name="newuser_email" id="newuser_email2" value="<?php echo $profiledata->user_email ?>" /></td> 176 </tr> 177 <tr> 178 <th scope="row"><?php _e('Website:') ?></th> 179 <td><input type="text" name="newuser_url" id="newuser_url2" value="<?php echo $profiledata->user_url ?>" /></td> 180 </tr> 181 <tr> 182 <th scope="row"><?php _e('ICQ:') ?></th> 183 <td><input type="text" name="newuser_icq" id="newuser_icq2" value="<?php if ($profiledata->user_icq > 0) { echo $profiledata->user_icq; } ?>" /></td> 184 </tr> 185 <tr> 186 <th scope="row"><?php _e('AIM:') ?></th> 187 <td><input type="text" name="newuser_aim" id="newuser_aim2" value="<?php echo $profiledata->user_aim ?>" /></td> 188 </tr> 189 <tr> 190 <th scope="row"><?php _e('MSN IM:') ?> </th> 191 <td><input type="text" name="newuser_msn" id="newuser_msn2" value="<?php echo $profiledata->user_msn ?>" /></td> 192 </tr> 193 <tr> 194 <th scope="row"><?php _e('Yahoo IM:') ?> </th> 195 <td> <input type="text" name="newuser_yim" id="newuser_yim2" value="<?php echo $profiledata->user_yim ?>" /> </td> 196 </tr> 197 <tr> 198 <th scope="row"><?php _e('Identity on blog:') ?> </th> 170 <th scope="row"><?php _e('How to display name:') ?> </th> 199 171 <td><select name="newuser_idmode"> 200 172 <option value="nickname"<?php … … 204 176 if ($profiledata->user_idmode=="login") 205 177 echo ' selected="selected"'; ?>><?php echo $profiledata->user_login ?></option> 178 <?php if ( !empty( $profiledata->user_firstname ) ) : ?> 206 179 <option value="firstname"<?php 207 180 if ($profiledata->user_idmode=="firstname") 208 181 echo ' selected="selected"'; ?>><?php echo $profiledata->user_firstname ?></option> 182 <?php endif; ?> 183 <?php if ( !empty( $profiledata->user_lastname ) ) : ?> 209 184 <option value="lastname"<?php 210 185 if ($profiledata->user_idmode=="lastname") 211 186 echo ' selected="selected"'; ?>><?php echo $profiledata->user_lastname ?></option> 187 <?php endif; ?> 188 <?php if ( !empty( $profiledata->user_firstname ) && !empty( $profiledata->user_lastname ) ) : ?> 212 189 <option value="namefl"<?php 213 190 if ($profiledata->user_idmode=="namefl") 214 191 echo ' selected="selected"'; ?>><?php echo $profiledata->user_firstname." ".$profiledata->user_lastname ?></option> 192 <?php endif; ?> 193 <?php if ( !empty( $profiledata->user_firstname ) && !empty( $profiledata->user_lastname ) ) : ?> 215 194 <option value="namelf"<?php 216 195 if ($profiledata->user_idmode=="namelf") 217 196 echo ' selected="selected"'; ?>><?php echo $profiledata->user_lastname." ".$profiledata->user_firstname ?></option> 197 <?php endif; ?> 218 198 </select> </td> 199 </tr> 200 <tr> 201 <th scope="row"><?php _e('E-mail:') ?></th> 202 <td><input type="text" name="newuser_email" id="newuser_email2" value="<?php echo $profiledata->user_email ?>" /></td> 203 </tr> 204 <tr> 205 <th scope="row"><?php _e('Website:') ?></th> 206 <td><input type="text" name="newuser_url" id="newuser_url2" value="<?php echo $profiledata->user_url ?>" /></td> 207 </tr> 208 <tr> 209 <th scope="row"><?php _e('ICQ:') ?></th> 210 <td><input type="text" name="newuser_icq" id="newuser_icq2" value="<?php if ($profiledata->user_icq > 0) { echo $profiledata->user_icq; } ?>" /></td> 211 </tr> 212 <tr> 213 <th scope="row"><?php _e('AIM:') ?></th> 214 <td><input type="text" name="newuser_aim" id="newuser_aim2" value="<?php echo $profiledata->user_aim ?>" /></td> 215 </tr> 216 <tr> 217 <th scope="row"><?php _e('MSN IM:') ?> </th> 218 <td><input type="text" name="newuser_msn" id="newuser_msn2" value="<?php echo $profiledata->user_msn ?>" /></td> 219 </tr> 220 <tr> 221 <th scope="row"><?php _e('Yahoo IM:') ?> </th> 222 <td> <input type="text" name="newuser_yim" id="newuser_yim2" value="<?php echo $profiledata->user_yim ?>" /> </td> 223 </tr> 224 <tr> 225 <th scope="row"><?php _e('Profile:') ?></th> 226 <td><textarea name="user_description" rows="5" id="textarea2" style="width: 99%; "><?php echo $profiledata->user_description ?></textarea></td> 219 227 </tr> 220 228 <tr> trunk/wp-admin/upgrade-schema.php
r2156 r2166 205 205 add_option('advanced_edit', 0); 206 206 add_option('comment_max_links', 2); 207 // 1. 3207 // 1.5 208 208 add_option('default_email_category', 1, 'Posts by email go to this category'); 209 209 add_option('recently_edited'); … … 214 214 add_option('page_uris'); 215 215 add_option('blacklist_keys'); 216 add_option('comment_registration', 0); 216 217 217 218 // Delete unused options trunk/wp-comments-post.php
r2002 r2166 19 19 $comment_content = $_POST['comment']; 20 20 21 // If the user is logged in 22 get_currentuserinfo(); 23 if ( $user_ID ) : 24 $comment_author = $user_login; 25 $comment_author_email = $user_email; 26 $comment_author_url = str_replace('http://', '', $user_url); 27 else : 28 if ( get_option('comment_registration') ) 29 die( __('Sorry, you must be logged in to post a comment.') ); 30 endif; 31 21 32 $comment_type = ''; 22 23 $user_ip = apply_filters('pre_comment_user_ip', $_SERVER['REMOTE_ADDR']);24 33 25 34 if ( get_settings('require_name_email') && ('' == $comment_author_email || '' == $comment_author) ) … … 29 38 die( __('Error: please type a comment.') ); 30 39 31 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type' );40 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID'); 32 41 33 42 wp_new_comment($commentdata); trunk/wp-content/themes/default/comments.php
r2165 r2166 34 34 <br /> 35 35 36 37 38 36 <small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('e','',''); ?></small> 39 37 40 38 <?php comment_text() ?> 41 39 42 40 </li> 43 44 <?php /* Changes every other comment to a different class */45 if ('alt' == $oddcomment) $oddcomment = '';46 else $oddcomment = 'alt';47 ?>41 42 <?php /* Changes every other comment to a different class */ 43 if ('alt' == $oddcomment) $oddcomment = ''; 44 else $oddcomment = 'alt'; 45 ?> 48 46 49 47 <?php endforeach; /* end for each comment */ ?> … … 67 65 68 66 <h3 id="respond">Leave a Reply</h3> 69 <form action="<?php echo get_settings('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> 67 68 <?php if ( get_option('comment_registration') && !$user_ID ) : ?> 69 <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.</p> 70 <?php else : ?> 71 72 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform"> 73 74 <?php if ( $user_ID ) : ?> 75 76 <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>">Logout »</a></p> 77 78 <?php else : ?> 70 79 71 80 <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" /> 72 <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />73 81 <label for="author"><small>Name <?php if ($req) _e('(required)'); ?></small></label></p> 74 82 … … 79 87 <label for="url"><small>Website</small></label></p> 80 88 89 <?php endif; ?> 90 81 91 <!--<p><small><strong>XHTML:</strong> You can use these tags: <?php echo allowed_tags(); ?></small></p>--> 82 92 83 93 <p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p> 84 94 85 <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" /></p> 95 <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" /> 96 <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /> 97 </p> 86 98 <?php do_action('comment_form', $post->ID); ?> 87 99 88 100 </form> 89 101 102 <?php endif; // If registration required and not logged in ?> 103 90 104 <?php endif; // if you delete this the sky will fall on your head ?> trunk/wp-includes/comment-functions.php
r2165 r2166 4 4 5 5 function comments_template() { 6 global $wp_query, $withcomments, $post, $wpdb, $id, $comment ;6 global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity; 7 7 8 8 if ( is_single() || is_page() || $withcomments ) : … … 18 18 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND ( comment_approved = '1' OR ( comment_author = '$author_db' AND comment_author_email = '$email_db' AND comment_approved = '0' ) ) ORDER BY comment_date"); 19 19 } 20 21 get_currentuserinfo(); 20 22 21 23 if ( file_exists( TEMPLATEPATH . '/comments.php') ) trunk/wp-includes/functions-post.php
r2151 r2166 430 430 $comment_post_ID = (int) $comment_post_ID; 431 431 432 $user_id = apply_filters('pre_user_id', $user_ID); 432 433 $author = apply_filters('pre_comment_author_name', $comment_author); 433 434 $email = apply_filters('pre_comment_author_email', $comment_author_email); … … 464 465 465 466 $result = $wpdb->query("INSERT INTO $wpdb->comments 466 (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type )467 (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, user_id) 467 468 VALUES 468 ('$comment_post_ID', '$author', '$email', '$url', '$user_ip', '$now', '$now_gmt', '$comment', '$approved', '$user_agent', '$comment_type' )469 ('$comment_post_ID', '$author', '$email', '$url', '$user_ip', '$now', '$now_gmt', '$comment', '$approved', '$user_agent', '$comment_type', '$user_id') 469 470 "); 470 471 trunk/wp-includes/functions.php
r2163 r2166 156 156 157 157 function get_currentuserinfo() { // a bit like get_userdata(), on steroids 158 global $user_login, $userdata, $user_level, $user_ID, $user_nickname, $user_email, $user_url, $user_pass_md5 ;158 global $user_login, $userdata, $user_level, $user_ID, $user_nickname, $user_email, $user_url, $user_pass_md5, $user_identity; 159 159 // *** retrieving user's data from cookies and db - no spoofing 160 160 … … 168 168 $user_url = $userdata->user_url; 169 169 $user_pass_md5 = md5($userdata->user_pass); 170 171 $idmode = $userdata->user_idmode; 172 if ($idmode == 'nickname') $user_identity = $userdata->user_nickname; 173 if ($idmode == 'login') $user_identity = $userdata->user_login; 174 if ($idmode == 'firstname') $user_identity = $userdata->user_firstname; 175 if ($idmode == 'lastname') $user_identity = $userdata->user_lastname; 176 if ($idmode == 'namefl') $user_identity = $userdata->user_firstname.' '.$userdata->user_lastname; 177 if ($idmode == 'namelf') $user_identity = $userdata->user_lastname.' '.$userdata->user_firstname; 178 if (!$idmode) $user_identity = $userdata->user_nickname; 170 179 } 171 180
