Make WordPress Core


Ignore:
Timestamp:
02/11/2004 04:51:19 AM (21 years ago)
Author:
rboren
Message:

Add author_name query and author permalinks.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-blog-header.php

    r836 r863  
    1111require($curpath.'/wp-config.php');
    1212
    13 $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');
     13$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');
    1414
    1515    for ($i=0; $i<count($wpvarstoreset); $i += 1) {
     
    226226}
    227227
     228// Author stuff for nice URIs
     229
     230if ('' != $author_name) {
     231    if (stristr($author_name,'/')) {
     232        $author_name = explode('/',$author_name);
     233        if ($author_name[count($author_name)-1]) {
     234        $author_name = $author_name[count($author_name)-1];#no trailing slash
     235        } else {
     236        $author_name = $author_name[count($author_name)-2];#there was a trailling slash
     237        }
     238    }
     239    $author_name = preg_replace('|[^a-z0-9-]|', '', strtolower($author_name));
     240    $author = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_nicename='".$author_name."'");
     241    $whichauthor .= ' AND (post_author = '.intval($author).')';
     242}
     243
    228244$where .= $search.$whichcat.$whichauthor;
    229245
Note: See TracChangeset for help on using the changeset viewer.