1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8//this script may only be included - so its better to die if called directly.
9if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
10	header("location: index.php");
11	exit;
12}
13
14
15/**
16 * @return array
17 */
18function module_user_blogs_info()
19{
20	return [
21		'name' => tra('My Blogs'),
22		'description' => tra('Displays to registered users their blogs.'),
23		'prefs' => ['feature_blogs'],
24		'params' => [],
25		'common_params' => ["nonums"]
26	];
27}
28
29/**
30 * @param $mod_reference
31 * @param $module_params
32 */
33function module_user_blogs($mod_reference, $module_params)
34{
35	global $user;
36	if ($user) {
37		$smarty = TikiLib::lib('smarty');
38		$bloglib = TikiLib::lib('blog');
39		$ranking = $bloglib->list_user_blogs($user, false);
40
41		$smarty->assign('modUserBlogs', $ranking);
42		$smarty->assign('tpl_module_title', tra("My blogs"));
43	}
44}
45