Make WordPress Core

Changeset 1933


Ignore:
Timestamp:
12/09/2004 02:40:35 AM (22 years ago)
Author:
rboren
Message:

get_author_permastruct()

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/classes.php

    r1910 r1933  
    703703        var $category_base;
    704704        var $category_structure;
     705        var $author_structure;
    705706        var $date_structure;
    706707        var $front;
     
    878879        }
    879880
     881        function get_author_permastruct() {
     882                if (isset($this->author_structure)) {
     883                        return $this->author_structure;
     884                }
     885
     886    if (empty($this->permalink_structure)) {
     887                        $this->author_structure = '';
     888                        return false;
     889                }
     890
     891                $this->author_structure = $this->front . 'author/%author%';
     892
     893                return $this->author_structure;
     894        }
     895
    880896        function add_rewrite_tag($tag, $pattern, $query) {
    881897                $this->rewritecode[] = $tag;
     
    10051021
    10061022                // Authors
    1007                 $author_structure = $this->front . 'author/%author%';
    1008                 $author_rewrite = $this->generate_rewrite_rules($author_structure);
     1023                $author_rewrite = $this->generate_rewrite_rules($this->get_author_permastruct());
    10091024
    10101025                // Pages
     
    10791094                $this->category_base = get_settings('category_base');
    10801095                unset($this->category_structure);
     1096                unset($this->author_structure);
    10811097                unset($this->date_structure);           
    10821098        }
  • trunk/wp-includes/template-functions-author.php

    r1582 r1933  
    7878
    7979function get_author_link($echo = false, $author_id, $author_nicename) {
    80     global $wpdb, $post, $querystring_start, $querystring_equal, $cache_userdata;
     80        global $wpdb, $wp_rewrite, $post, $querystring_start, $querystring_equal, $cache_userdata;
    8181    $auth_ID = $author_id;
    82     $permalink_structure = get_settings('permalink_structure');
     82    $link = $wp_rewrite->get_author_permastruct();
    8383   
    84     if ('' == $permalink_structure) {
     84    if (empty($link)) {
    8585        $file = get_settings('home') . '/' . get_settings('blogfilename');
    8686        $link = $file.$querystring_start.'author'.$querystring_equal.$auth_ID;
    8787    } else {
    8888        if ('' == $author_nicename) $author_nicename = $cache_userdata[$author_id]->author_nicename;
    89         // Get any static stuff from the front
    90         $front = substr($permalink_structure, 0, strpos($permalink_structure, '%'));
    91         $link = get_settings('home') . $front . 'author/';
    92         $link .= $author_nicename . '/';
     89                                $link = str_replace('%author%', $author_nicename, $link);
     90                                $link = get_settings('home') . trailingslashit($link);
    9391    }
    9492
Note: See TracChangeset for help on using the changeset viewer.