From b880405421bd43bf1ca91610a28bebcef56bd50b Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 10 Feb 2004 22:50:04 +0000 Subject: - Usability improvement: print a message if you are (not) allowed to print forum topics. --- modules/forum/forum.module | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'modules/forum/forum.module') diff --git a/modules/forum/forum.module b/modules/forum/forum.module index 514b96cdf..a4ea08380 100644 --- a/modules/forum/forum.module +++ b/modules/forum/forum.module @@ -546,7 +546,7 @@ function theme_forum_list($forums, $parents, $tid) { $rows[] = array( array('data' => $description, 'class' => 'forum'), - array('data' => $forum->num_topics . ($new_topics ? "
(". l(t('%a new', array('%a' => $new_topics)), "forum/$forum->tid", NULL, NULL, 'new') .")" : ''), 'class' => 'topics'), + array('data' => $forum->num_topics . ($new_topics ? "
". l(t('%a new', array('%a' => $new_topics)), "forum/$forum->tid", NULL, NULL, 'new') : ''), 'class' => 'topics'), array('data' => $forum->num_posts, 'class' => 'posts'), array('data' => _forum_format($forum->last_post), 'class' => 'last-reply')); } @@ -568,7 +568,7 @@ function theme_forum_list($forums, $parents, $tid) { * @return output for the topic list. */ function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page, $offset) { - global $id, $status, $user, $pager_total, $forum_topic_list_header; + global $user, $id, $status, $user, $pager_total, $forum_topic_list_header; if ($topics) { @@ -585,7 +585,7 @@ function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page, $offset $rows[] = array( array('data' => _forum_icon($topic->new, $topic->num_comments, $topic->comment_mode), 'class' => 'icon'), array('data' => l($topic->title, "node/view/$topic->nid"), 'class' => 'topic'), - array('data' => $topic->num_comments . ($topic->new_replies ? "
(". l(t('%a new', array('%a' => $topic->new_replies)), "node/view/$topic->nid", NULL, NULL, 'new') .")" : ''), 'class' => 'replies'), + array('data' => $topic->num_comments . ($topic->new_replies ? "
". l(t('%a new', array('%a' => $topic->new_replies)), "node/view/$topic->nid", NULL, NULL, 'new') : ''), 'class' => 'replies'), array('data' => _forum_format($topic), 'class' => 'created'), array('data' => _forum_format($topic->last_reply), 'class' => 'last-reply') ); @@ -597,9 +597,14 @@ function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page, $offset } } - if (user_access('create forum topics')) { - $output = l(t('create new forum topic'), "node/add/forum/$tid") ."

"; + $output = '

'. t('You can post new forum topics.', array('%post' => url("node/add/forum/$tid"))) .'

'; + } + else if ($user->uid) { + $output = '

'. t('You are not allowed to post new forum topics.') .'

'; + } + else { + $output = '

'. t('You must login to post new forum topics.', array('%login' => url('user/login'))) .'

'; } $output .= theme('table', $forum_topic_list_header, $rows); -- cgit v1.2.3