From 0a34939fd74302b83e4c48f1bc36a35e11bc3edf Mon Sep 17 00:00:00 2001
From: rica-carv <rica-carv@users.noreply.github.com>
Date: Mon, 21 Nov 2016 18:35:52 +0000
Subject: [PATCH 1/3] Update forum_viewforum.php

Permisions check should be on post, not thread.
With thread, the "create new topic" is displayed in the dropdown, and it shouldn't if user is not allowed to create posts....
---
 e107_plugins/forum/forum_viewforum.php | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/e107_plugins/forum/forum_viewforum.php b/e107_plugins/forum/forum_viewforum.php
index 5d6040100..582d38798 100644
--- a/e107_plugins/forum/forum_viewforum.php
+++ b/e107_plugins/forum/forum_viewforum.php
@@ -281,7 +281,8 @@ if ($pages)
 	}
 }
 
-if($forum->checkPerm($forumId, 'thread')) //new thread access only.
+//-- if($forum->checkPerm($forumId, 'thread')) //new thread access only.
+if($forum->checkPerm($forumId, 'post')) //new thread access only.
 {
 		$forumSCvars['ntUrl']= e107::url('forum','post')."?f=nt&amp;id=". $forumId;
 /*--

From 00899a0da93b562d2ce89932caa73b0119e42518 Mon Sep 17 00:00:00 2001
From: rica-carv <rica-carv@users.noreply.github.com>
Date: Mon, 21 Nov 2016 18:50:41 +0000
Subject: [PATCH 2/3] Update view_shortcodes.php

---
 e107_plugins/forum/shortcodes/batch/view_shortcodes.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php
index 8ddbad5e5..9cfe9f6ab 100644
--- a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php
+++ b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php
@@ -804,7 +804,7 @@ function sc_buttonsx()
 	//	$url = e107::getUrl()->create('forum/thread/reply', array('id' => $thread->threadId));
 		$replyUrl = "<a class='btn btn-primary' href='".$url."'>".LAN_FORUM_2006."</a>";
 	}
-	if ($forum->checkPerm($this->var['thread_forum_id'], 'thread'))
+	if ($forum->checkPerm($this->var['thread_forum_id'], 'post'))
 	{
 		$ntUrl = e107::url('forum','post')."?f=nt&amp;id=". $this->var['thread_forum_id'];
 	//	$ntUrl = e107::getUrl()->create('forum/thread/new', array('id' => $thread->threadInfo['thread_forum_id']));
@@ -829,7 +829,7 @@ function sc_buttonsx()
 
 
 	$text = '<div class="btn-group">
-   '.$replyUrl.'
+   '.($replyUrl?:LAN_FORUM_1003." ".LAN_FORUM_8013).'
     <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
     <span class="caret"></span>
     </button>

From b6d3c46c5ce09f58b10db57dfa69334dd224daff Mon Sep 17 00:00:00 2001
From: rica-carv <rica-carv@users.noreply.github.com>
Date: Mon, 21 Nov 2016 18:53:47 +0000
Subject: [PATCH 3/3] Update viewforum_shortcodes.php

---
 .../shortcodes/batch/viewforum_shortcodes.php | 21 +++++++------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php b/e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php
index b90c0d2cd..0f3beb911 100644
--- a/e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php
+++ b/e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php
@@ -80,20 +80,13 @@
 			global $forum;
 			$jumpList = $forum->forumGetAllowed('view');
 
-
-			$text = '<div class="btn-group">';
-
-			if(!empty($this->var['ntUrl']))
-			{
-				$text .= '<a href="' . $this->var['ntUrl'] . '" class="btn btn-primary">' . LAN_FORUM_1018 . '</a>';
-			}
-
-			$text .= '
-		    <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
-		    <span class="caret"></span>
-		    </button>
-		    <ul class="dropdown-menu pull-right">
-		    ';
+			$text = '<div class="btn-group">'.
+			($this->var['ntUrl']?<a href="'.$this->var['ntUrl'].'" class="btn btn-primary">'.LAN_FORUM_1018.'</a>:LAN_FORUM_1001." ".LAN_FORUM_8013).
+		    	'<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
+		    	<span class="caret"></span>
+		    	</button>
+		    	<ul class="dropdown-menu pull-right">
+		    	';
 
 			//--	foreach($jumpList as $key => $val)
 			foreach($jumpList as $val)