Browse Source

Include author info in each post

pull/463/head
danpros 4 years ago
parent
commit
261299a7f6
2 changed files with 17 additions and 19 deletions
  1. +8
    -19
      system/htmly.php
  2. +9
    -0
      system/includes/functions.php

+ 8
- 19
system/htmly.php View File

@ -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'];


+ 9
- 0
system/includes/functions.php View File

@ -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…
Cancel
Save