You can try and apply this code for the flyout menu and see if it works, comment out the original in the plugin… for testing
public function base_flyoutMenu_handler($sender) {
// Signed in users only. No guest reporting!
if (Gdn::session()->UserID) {
$this->addFlagButton($Sender, $Args, 'discussion');
}
}
public function base_flyoutMenu_handler($sender) {
// Signed in users only. No guest reporting!
if (Gdn::session()->UserID) {
$this->addFlagButton($Sender, $Args);
}
}
//comment out these bellow for testing
/**
* Add 'Flag' link for discussions.
*/
public function discussionController_afterDiscussionMeta_handler($Sender, $Args) {
// Signed in users only. No guest reporting!
if (Gdn::session()->UserID) {
$this->addFlagButton($Sender, $Args, 'discussion');
}
}
/**
* Add 'Flag' link for comments.
*/
public function discussionController_insideCommentMeta_handler($Sender, $Args) {
// Signed in users only. No guest reporting!
if (Gdn::session()->UserID) {
$this->addFlagButton($Sender, $Args);
}
}
It's not that easy. The format of addFlagButton is not the needed format for the discussion opotions.
You would need at least two new methods:
// For discussions:
public function discussionController_discussionOptions_handler($sender, $args) {
if (!Gdn::session()->UserID) {
return;
}
$url = ''; // See addFlagButton() and reform the url for discussions here.
$args['DiscussionOptions']['Flagging'] = array(
'Label' => t('The text in the menu'),
'Url' => 'discussion/flag/'.$url,
'Class' => 'FlagContent Popup'
);
}
// For comments:
public function discussionController_commentOptions_handler($sender, $args) {
if (!Gdn::session()->UserID) {
return;
}
$url = ''; // See addFlagButton() and reform the url for comments here.
$args['CommentOptions']['Flagging'] = array(
'Label' => t('The text in the menu'),
'Url' => 'discussion/flag/'.$url,
'Class' => 'FlagContent Popup'
);
}
You would have to use the code from the plugins addFlagButton method and try to customize so that you can use it inside those two functions. Then you would have to hide the button in the reactions area and that's it. If you get stuck when building the url for the flagging plugin, just ask.
Comments
You can try and apply this code for the flyout menu and see if it works, comment out the original in the plugin… for testing
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Thanks ! I commentend out the Add "Flag" link part and added the new code (to class.flagging.plugin.php) but "Flag" does not show up in the menu.
It's not that easy. The format of addFlagButton is not the needed format for the discussion opotions.
You would need at least two new methods:
You would have to use the code from the plugins addFlagButton method and try to customize so that you can use it inside those two functions. Then you would have to hide the button in the reactions area and that's it. If you get stuck when building the url for the flagging plugin, just ask.