|
Revision 2356, 0.6 kB
(checked in by takayama, 19 months ago)
|
|
Fixed BugId:79763
* When author object was not found in the context, try to load author object from entry in the context
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | # Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd. |
|---|
| 3 | # This program is distributed under the terms of the |
|---|
| 4 | # GNU General Public License, version 2. |
|---|
| 5 | # |
|---|
| 6 | # $Id$ |
|---|
| 7 | |
|---|
| 8 | function smarty_function_mtauthorname($args, &$ctx) { |
|---|
| 9 | $author = $ctx->stash('author'); |
|---|
| 10 | if (empty($author)) { |
|---|
| 11 | $entry = $ctx->stash('entry'); |
|---|
| 12 | if (!empty($entry)) { |
|---|
| 13 | $author = $ctx->mt->db->fetch_author($entry['entry_author_id']); |
|---|
| 14 | } |
|---|
| 15 | } |
|---|
| 16 | |
|---|
| 17 | if (empty($author)) { |
|---|
| 18 | return $ctx->error("No author available"); |
|---|
| 19 | } |
|---|
| 20 | return $author['author_name']; |
|---|
| 21 | } |
|---|
| 22 | ?> |
|---|