Add author_name query and author permalinks.
git-svn-id: http://svn.automattic.com/wordpress/trunk@863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bca08d2d24
commit
ba712e9192
|
@ -177,6 +177,8 @@ $sitecommentfeedquery = $site_root . 'wp-feed.php?feed=$1&withcomments=1';
|
|||
$front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
|
||||
$catmatch = $front . 'category/';
|
||||
$catmatch = preg_replace('|^/+|', '', $catmatch);
|
||||
$authormatch = $front . 'author/';
|
||||
$authormatch = preg_replace('|^/+|', '', $authormatch);
|
||||
|
||||
?>
|
||||
<form action"">
|
||||
|
@ -187,6 +189,8 @@ RewriteRule ^<?php echo $feedmatch; echo '$ ' . $site_root . $feedquery ?> [QSA]
|
|||
RewriteRule ^<?php echo $trackbackmatch; echo '$ ' . $site_root . $trackbackquery ?> [QSA]
|
||||
RewriteRule ^<?php echo $catmatch; ?>(.*)/<?php echo $feedregex ?>$ <?php echo $site_root; ?>wp-feed.php?category_name=$1&feed=$2 [QSA]
|
||||
RewriteRule ^<?php echo $catmatch; ?>?(.*) <?php echo $site_root; ?>index.php?category_name=$1 [QSA]
|
||||
RewriteRule ^<?php echo $authormatch; ?>(.*)/<?php echo $feedregex ?>$ <?php echo $site_root; ?>wp-feed.php?author_name=$1&feed=$2 [QSA]
|
||||
RewriteRule ^<?php echo $authormatch; ?>?(.*) <?php echo $site_root; ?>index.php?author_name=$1 [QSA]
|
||||
RewriteRule ^<?php echo $sitefeedmatch; ?> <?php echo $sitefeedquery ?> [QSA]
|
||||
RewriteRule ^<?php echo $sitecommentfeedmatch; ?> <?php echo $sitecommentfeedquery ?> [QSA]</textarea>
|
||||
</form>
|
||||
|
|
|
@ -680,6 +680,17 @@ function upgrade_110() {
|
|||
maybe_add_column($tableusers, 'user_status', "ALTER TABLE `$tableusers` ADD `user_status` INT DEFAULT '0' NOT NULL ;");
|
||||
$wpdb->query("ALTER TABLE `$tableposts` CHANGE `comment_status` `comment_status` ENUM( 'open', 'closed', 'registered_only' ) DEFAULT 'open' NOT NULL");
|
||||
|
||||
maybe_add_column($tableusers, 'user_nicename', "ALTER TABLE `$tableusers` ADD `user_nicename` VARCHAR(50) DEFAULT '' NOT NULL ;");
|
||||
|
||||
// Set user_nicename.
|
||||
$users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $tableusers");
|
||||
foreach ($users as $user) {
|
||||
if ('' == $user->user_nicename) {
|
||||
$newname = sanitize_title($user->user_nickname);
|
||||
$wpdb->query("UPDATE $tableusers SET user_nicename = '$newname' WHERE ID = '$user->ID'");
|
||||
}
|
||||
}
|
||||
|
||||
// Convert passwords to MD5 and update table appropiately
|
||||
$query = 'DESCRIBE '.$tableusers.' user_pass';
|
||||
$res = $wpdb->get_results($query);
|
||||
|
|
|
@ -66,14 +66,15 @@ case 'adduser':
|
|||
$user_login = addslashes(stripslashes($user_login));
|
||||
$pass1 = addslashes(stripslashes($pass1));
|
||||
$user_nickname = addslashes(stripslashes($user_nickname));
|
||||
$user_nicename = sanitize_title($user_nickname);
|
||||
$user_firstname = addslashes(stripslashes($user_firstname));
|
||||
$user_lastname = addslashes(stripslashes($user_lastname));
|
||||
$now = current_time('mysql');
|
||||
|
||||
$result = $wpdb->query("INSERT INTO $tableusers
|
||||
(user_login, user_pass, user_nickname, user_email, user_ip, user_domain, user_browser, dateYMDhour, user_level, user_idmode, user_firstname, user_lastname)
|
||||
(user_login, user_pass, user_nickname, user_email, user_ip, user_domain, user_browser, dateYMDhour, user_level, user_idmode, user_firstname, user_lastname, user_nicename)
|
||||
VALUES
|
||||
('$user_login', MD5('$pass1'), '$user_nickname', '$user_email', '$user_ip', '$user_domain', '$user_browser', '$now', '$new_users_can_blog', 'nickname', '$user_firstname', '$user_lastname')");
|
||||
('$user_login', MD5('$pass1'), '$user_nickname', '$user_email', '$user_ip', '$user_domain', '$user_browser', '$now', '$new_users_can_blog', 'nickname', '$user_firstname', '$user_lastname', '$user_nicename')");
|
||||
|
||||
if ($result == false) {
|
||||
die ('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:'.$admin_email.'">webmaster</a> !');
|
||||
|
|
|
@ -10,7 +10,7 @@ if (!file_exists($curpath . '/wp-config.php'))
|
|||
|
||||
require($curpath.'/wp-config.php');
|
||||
|
||||
$wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'name', 'category_name', 'feed');
|
||||
$wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'name', 'category_name', 'feed', 'author_name');
|
||||
|
||||
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
||||
$wpvar = $wpvarstoreset[$i];
|
||||
|
@ -225,6 +225,22 @@ if ((empty($author)) || ($author == 'all') || ($author == '0')) {
|
|||
$whichauthor .= ')';
|
||||
}
|
||||
|
||||
// Author stuff for nice URIs
|
||||
|
||||
if ('' != $author_name) {
|
||||
if (stristr($author_name,'/')) {
|
||||
$author_name = explode('/',$author_name);
|
||||
if ($author_name[count($author_name)-1]) {
|
||||
$author_name = $author_name[count($author_name)-1];#no trailing slash
|
||||
} else {
|
||||
$author_name = $author_name[count($author_name)-2];#there was a trailling slash
|
||||
}
|
||||
}
|
||||
$author_name = preg_replace('|[^a-z0-9-]|', '', strtolower($author_name));
|
||||
$author = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_nicename='".$author_name."'");
|
||||
$whichauthor .= ' AND (post_author = '.intval($author).')';
|
||||
}
|
||||
|
||||
$where .= $search.$whichcat.$whichauthor;
|
||||
|
||||
if ((empty($order)) || ((strtoupper($order) != 'ASC') && (strtoupper($order) != 'DESC'))) {
|
||||
|
|
Loading…
Reference in New Issue