Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Move "Flagging" link to cogwheel menu

Would it be possible to move the "Flag this content" to the menu (see attached image) ?

Comments

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    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);
                }
            }
    
  • Options

    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.

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    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.

Sign In or Register to comment.