HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Mod to group stickies together on discussion topic pages (by AaronWebstey).

peregrineperegrine MVP
edited January 2015 in Feedback

@AaronWebstey said:

I've modified my version of this plugin so that you can choose to 'Group all forum-level Stickies together on Discussion Topic Pages'. This plugin kicks ass, but looked a bit weird for me since each of my 2 or 3 announcements had their own date label. Use at your own risk; it's only been tested a bit by myself and I think @peregrine‌ is about done with my incessant ranting about this plugin. :)

Excuse the blanked-out titles, as well as the 'stickies' instead of 'announcements' text. It will show up as 'announcements' for you if you have not messed with locale.php like I have.

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Comments

  • peregrineperegrine MVP
    edited January 2015

    Peregrine is not responsible for these changes and Aaron is supporting you on these changes.

    here are @AaronWebstey's code snippets.

    here are your code snippet changes.

    change the datejumper-settings.php and insert this among the other settings.

             <li>
                    <?php
                    echo $this->Form->CheckBox('Plugins.DateJumper.GroupAnnouncements', "Group all forum-level " . T('Announcements') . " together on Discussion Topic Pages (show only one Date Jumper Label '" . T('Announcements') . "')");
                    ?>
                </li>
    

    in class.datejumper.plugin.php

    change

    this to

             $ConfigurationModel->SetField(array(
                        'Plugins.DateJumper.ShowInDiscussions',
                        'Plugins.DateJumper.ShowInComments'
              ));
    

    to this:

     $ConfigurationModel->SetField(array(
                'Plugins.DateJumper.ShowInDiscussions',
                'Plugins.DateJumper.GroupAnnouncements',
                'Plugins.DateJumper.ShowInComments'
        ));
    

    and this

       private function DisplayDiscussionDateHeading($Sender) {
            $Discussion = $Sender->EventArguments["Discussion"];
    
            static $KeepDate;
    

    to this:

    private function DisplayDiscussionDateHeading($Sender) {
        $Discussion = $Sender->EventArguments["Discussion"];
    
        if (C('Plugins.DateJumper.GroupAnnouncements', FALSE)) {
            static $x=1;
            if(GetValue('Announce', $Discussion) == 1) {
                if($x < 2) {
                  echo wrap(wrap(T("Announcements"), 'span', array('class' => "DiscussionDateSpacer")), 'li');
                }
                $x++;
                return;     
            }
        }
        static $KeepDate;
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Thanks YAP for showing me the ropes here. Love this plugin!

Sign In or Register to comment.