|
Revision 2356, 0.8 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_block_mtauthoruserpicasset($args, $content, &$ctx, &$repeat) { |
|---|
| 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 | if (empty($author)) { |
|---|
| 17 | return $ctx->error("No author available"); |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | $asset_id = isset($author['author_userpic_asset_id']) ? $author['author_userpic_asset_id'] : 0; |
|---|
| 21 | $asset = $ctx->mt->db->fetch_assets(array('id' => $asset_id)); |
|---|
| 22 | if (!$asset) return ''; |
|---|
| 23 | |
|---|
| 24 | $ctx->stash('asset', $asset[0]); |
|---|
| 25 | |
|---|
| 26 | return $content; |
|---|
| 27 | } |
|---|
| 28 | ?> |
|---|