--- blog_list/blog_list.module 2008-02-26 23:08:23.000000000 +0100
+++ blog_list.module 2008-07-31 07:39:54.000000000 +0200
@@ -7,6 +7,13 @@
*/
/**
+ * Permissions
+ */
+function blog_list_perm() {
+ return array('access blog list');
+}
+
+/**
* Provide a "blogs" menu item that links
* to the list of blogs.
*
@@ -20,7 +27,7 @@ function blog_list_menu($may_cache) {
if ($may_cache) {
$items[] = array('path' => 'blogs', 'title' => t('Blogs'),
'callback' => 'blog_list_blog_list',
- 'access' => user_access('access content'),
+ 'access' => user_access('access blog list'),
'type' => MENU_SUGGESTED_ITEM);
}
return $items;
@@ -34,24 +41,24 @@ function blog_list_menu($may_cache) {
*/
function blog_list_blog_list() {
global $user;
-
- $output = '
' .
- '| User |
' .
- '';
-
- $result = pager_query(db_rewrite_sql("SELECT DISTINCT u.name, u.uid FROM {users} u INNER JOIN {node} n ON u.uid = n.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), variable_get('default_nodes_main', 10));
-
- $odd = TRUE;
- while ($row = db_fetch_array($result)) {
- $output .= '' .
- '| ' . l($row['name'], 'blog/' . $row['uid']) . ' | ' .
- '
';
- $odd = !$odd;
+ if (user_access('access blog list')) {
+ $output = '' .
+ '| User |
' .
+ '';
+
+ $result = pager_query(db_rewrite_sql("SELECT DISTINCT u.name, u.uid FROM {users} u INNER JOIN {node} n ON u.uid = n.uid WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), variable_get('default_nodes_main', 10));
+
+ $odd = TRUE;
+ while ($row = db_fetch_array($result)) {
+ $output .= '' .
+ '| ' . l($row['name'], 'blog/' . $row['uid']) . ' | ' .
+ '
';
+ $odd = !$odd;
+ }
+ $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
+
+ $output .= '' .
+ '
';
}
- $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
-
- $output .= '' .
- '
';
-
return $output;
}