mirror of
https://github.com/danpros/htmly.git
synced 2026-04-21 21:16:23 +05:30
Include author info in each post
This commit is contained in:
parent
e931413d2d
commit
261299a7f6
2 changed files with 17 additions and 19 deletions
|
|
@ -2246,13 +2246,10 @@ get('/post/:name', function ($name) {
|
|||
}
|
||||
}
|
||||
|
||||
$author = get_author($current->author);
|
||||
|
||||
if (isset($author[0])) {
|
||||
$author = $author[0];
|
||||
} else {
|
||||
$author = default_profile($current->author);
|
||||
}
|
||||
$author = new stdClass;
|
||||
$author->url = $current->authorUrl;
|
||||
$author->name = $current->authorName;
|
||||
$author->about = $current->authorAbout;
|
||||
|
||||
if (array_key_exists('prev', $post)) {
|
||||
$prev = $post['prev'];
|
||||
|
|
@ -3002,11 +2999,6 @@ get('/:static/:sub', function ($static, $sub) {
|
|||
$url = site_url() . 'search/' . remove_accent($search);
|
||||
header("Location: $url");
|
||||
}
|
||||
|
||||
if ($static === 'front') {
|
||||
$redir = site_url();
|
||||
header("location: $redir", TRUE, 301);
|
||||
}
|
||||
|
||||
$father_post = get_static_post($static);
|
||||
if (!$father_post) {
|
||||
|
|
@ -3242,13 +3234,10 @@ get('/:year/:month/:name', function ($year, $month, $name) {
|
|||
}
|
||||
}
|
||||
|
||||
$author = get_author($current->author);
|
||||
|
||||
if (isset($author[0])) {
|
||||
$author = $author[0];
|
||||
} else {
|
||||
$author = default_profile($current->author);
|
||||
}
|
||||
$author = new stdClass;
|
||||
$author->url = $current->authorUrl;
|
||||
$author->name = $current->authorName;
|
||||
$author->about = $current->authorAbout;
|
||||
|
||||
if (array_key_exists('prev', $post)) {
|
||||
$prev = $post['prev'];
|
||||
|
|
|
|||
|
|
@ -288,6 +288,15 @@ function get_posts($posts, $page = 1, $perpage = 0)
|
|||
// The post author + author url
|
||||
$post->author = $author;
|
||||
$post->authorUrl = site_url() . 'author/' . $author;
|
||||
|
||||
$profile = get_author($author);
|
||||
if (isset($profile[0])) {
|
||||
$post->authorName = $profile[0]->name;
|
||||
$post->authorAbout = $profile[0]->about;
|
||||
} else {
|
||||
$post->authorName = $author;
|
||||
$post->authorAbout = 'Just another HTMLy user';
|
||||
}
|
||||
|
||||
$post->type = $type;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue