diff --git a/_sakura/components/Main.php b/_sakura/components/Main.php index 1c7c1ae..9958854 100644 --- a/_sakura/components/Main.php +++ b/_sakura/components/Main.php @@ -150,6 +150,12 @@ class Main { // Get news posts $newsPosts = Database::fetch('news', true, null, ['id', true], ($limit ? [$limit] : null)); + // Get user data + foreach($newsPosts as $newsPost) { + $newsPost['udata'] = Users::getUser($newsPost['uid']); + $newsPost['gdata'] = Users::getGroup($newsPost['udata']['group_main']); + } + // Return posts return $newsPosts; diff --git a/_sakura/sakura.php b/_sakura/sakura.php index 7d86d6e..11e09a6 100644 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -11,7 +11,7 @@ namespace Sakura; ob_start(); // Define Sakura version -define('SAKURA_VERSION', '20150329'); +define('SAKURA_VERSION', '20150330'); // Define Sakura Path define('ROOT_DIRECTORY', str_replace('_sakura', '', dirname(__FILE__))); @@ -59,7 +59,5 @@ $renderData = array( ], 'user' => [ 'loggedin' => Users::loggedIn() - ], - 'users' => Users::getAllUsers(), - 'groups' => Users::getAllGroups() + ] ); diff --git a/_sakura/templates/yuuno/elements/newsPost.tpl b/_sakura/templates/yuuno/elements/newsPost.tpl index 1c77e26..deef25b 100644 --- a/_sakura/templates/yuuno/elements/newsPost.tpl +++ b/_sakura/templates/yuuno/elements/newsPost.tpl @@ -2,8 +2,8 @@
- {{ users[newsPost.uid].username }} -

{{ users[newsPost.uid].username }}

+ {{ newsPost.udata.username }} +

{{ newsPost.udata.username }}