@@ -91,39 +91,6 @@ public function base_InlineDiscussionOptionsLeft_handler($sender, $args){
91
91
echo '</span> ' ;
92
92
}
93
93
94
- public function base_inlineCommentOptionsRight_handler ($ sender , $ args ) {
95
- ReplyToPlugin::log ('base_inlineCommentOptionsRight_handler ' , []);
96
-
97
- if (!Gdn::Session ()->isValid ()) {
98
- return ;
99
- }
100
-
101
- $ discussion = $ sender ->data ('Discussion ' );
102
- $ isClosed = ((int )$ discussion ->Closed ) == 1 ;
103
- if ($ isClosed ) {
104
- return ;
105
- }
106
-
107
- //Check permission
108
- $ CategoryID = val ('PermissionCategoryID ' , $ discussion ) ? val ('PermissionCategoryID ' , $ discussion ) : val ('CategoryID ' , $ discussion );
109
-
110
- // Can the user comment on this category, and is the discussion open for comments?
111
- if (!Gdn::Session ()->CheckPermission ('Vanilla.Comments.Add ' , TRUE , 'Category ' , $ CategoryID )) {
112
- return ;
113
- }
114
-
115
- $ viewMode = self ::getViewMode ();
116
- $ comment = &$ args ['Comment ' ];
117
- $ items = & $ args ['Items ' ];
118
- $ commentID = val ('CommentID ' , $ comment );
119
- if (empty ($ items )) {
120
- $ items = [];
121
- }
122
- array_push ( $ items , anchor (
123
- t ('Reply ' ),
124
- url ("/?ParentCommentID= " .$ commentID ."&view= " .$ viewMode , false ), 'ReplyComment ' ));
125
- }
126
-
127
94
/**
128
95
* Set the tree order of all comments in the model as soon as it is instantiated.
129
96
* It is not clear if there are other plugins that may also wish to change the ordering.
@@ -242,9 +209,8 @@ public function base_commentOptions_handler($sender, $args) {
242
209
return ;
243
210
}
244
211
245
- /*
246
212
$ options = &$ args ['CommentOptions ' ];
247
- $comment = & $args['Comment'];
213
+ $ comment = $ args ['Comment ' ];
248
214
$ options ['ReplyToComment ' ] = [
249
215
'Label ' => t ('Reply ' ),
250
216
'Url ' => '/?ParentCommentID= ' .$ comment ->CommentID ,
@@ -264,7 +230,43 @@ public function base_commentOptions_handler($sender, $args) {
264
230
$ options [$ key ]['Url ' ] = $ currentUrl .'?view= ' .$ viewMode ;
265
231
}
266
232
}
267
- */
233
+ }
234
+
235
+ /**
236
+ * Add 'Reply' option to discussion.
237
+ *
238
+ * @param Gdn_Controller $sender
239
+ * @param array $args
240
+ */
241
+ public function base_inlineDiscussionOptions_handler ($ sender , $ args ) {
242
+ $ discussion = $ args ['Discussion ' ];
243
+ if (!$ discussion ) {
244
+ return ;
245
+ }
246
+
247
+ $ isClosed = ((int )$ discussion ->Closed ) == 1 ;
248
+ if ($ isClosed ) {
249
+ return ;
250
+ }
251
+
252
+ if (!Gdn::session ()->UserID ) {
253
+ return ;
254
+ }
255
+
256
+ //Check permission
257
+ if (isset ($ discussion ->PermissionCategoryID )) {
258
+ $ CategoryID = val ('PermissionCategoryID ' , $ discussion );
259
+ } else {
260
+ $ CategoryID = $ discussion ->CategoryID ;
261
+ }
262
+
263
+ // Can the user comment on this category, and is the discussion open for comments?
264
+ if (!Gdn::Session ()->CheckPermission ('Vanilla.Comments.Add ' , TRUE , 'Category ' , $ CategoryID )) {
265
+ return ;
266
+ }
267
+ // DropdownModule options
268
+ $ options = & $ args ['DiscussionOptions ' ];
269
+ $ options ->addLink ('Reply ' , url ("/ " , true ), 'reply ' , 'ReplyComment ' );
268
270
}
269
271
270
272
/**
0 commit comments