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

Help with home page

Dose anyone know a way to stop it when someone comments on a post it move up the list.

«1

Comments

  • Are you really looking for a forum? :3:p

    VizionStudios
  • R_JR_J Ex-Fanboy Munich Moderator

    If you are using Bootstrap, create a css rule like that:

    ul.Discussions li.Item {
      position:static;
    }
    

    so that they cannot move anymore!

    Or maybe

    ul.Discussions li.Item::after {
      content: "YOU SHALL NOT PASS!"
    }
    











    Just joking...
    That's the way "Recent Discussions" should be interpreted. You might like to look at yourforum.com/categories/discussions in order to get another way of showing discussions.


  • You can sink discussions, that you don't what to move up. it is usually done on an individual basis.

    grep is your friend.

  • hgtonighthgtonight ∞ · New Moderator

    You should be able to change the sort order via a config option.

    Try adding $Configuration['Vanilla']['Discussions']['SortField'] = 'd.DateInserted'; to your /conf/config.php file.

    You can also change the sort direction with $Configuration['Vanilla']['Discussions']['SortDirection] = 'asc'; // or 'desc'

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

    R_JVizionStudios
  • @hgtonight I was able to get it to stop moving but do you know how to do this with the date not update when someone comment to?

  • You would need to sink the discussion on update.

        public function CommentController_BeforeUpdateCommentCount_Hander($Sender, $Args) {
               $Sender->EventArguments['Discussion']['Sink'] = TRUE;
        }
    

    You could put that in a themehook file, I'm not going to help you more than that.

    grep is your friend.

  • I did it @x00 :smiley::smiley::smiley:

    R_J
  • hgtonighthgtonight ∞ · New Moderator

    @VizionMc said:
    hgtonight I was able to get it to stop moving but do you know how to do this with the date not update when someone comment to?

    You don't want the last update date shown? I would hook the discussions view:

    public function discussionsController_beforeDiscussionName_handler($sender) {
      $discussion =& $sender->EventArguments['Discussion'];
      $discussion->DateLastComment = $discussion->DateInserted;
    }
    

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • What file? I been trying do this for like 1hr :cry:

  • hgtonighthgtonight ∞ · New Moderator

    @VizionMc said:
    What file? I been trying do this for like 1hr :cry:

    Don't pick files out willy nilly. Add that code to your themehooks or into a new plugin.

    Please read the plugin quick start to understand what is happening: http://docs.vanillaforums.com/developers/plugins/quickstart/

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • See this is why I voted against smilies on a support forum. :angry:

    grep is your friend.

    R_JVizionStudios
  • x00x00 MVP
    edited May 2015

    It should actually be

    public function CommentModel_BeforeUpdateCommentCount_Handler($Sender, $Args) {
         $Sender->EventArguments['Discussion']['Sink'] = TRUE;
    }
    

    grep is your friend.

  • R_JR_J Ex-Fanboy Munich Moderator

    And add an "l" to "Hander" and a "$" to Sender ;)

    public function CommentModel_BeforeUpdateCommentCount_Handler($Sender, $Args) {
         $Sender->EventArguments['Discussion']['Sink'] = TRUE;
    }
    


  • indeed.

    grep is your friend.

  • edited May 2015

    Like this?

    <?php if (!defined('APPLICATION')) exit();
    
    // Define the plugin:
    $PluginInfo['VizionHooks'] = array(
       'Name' => 'VizionHooks Plugin',
       'Description' => 'VizionHooks Plugin.',
       'Version' => '1.0',
       'Author' => "VizionStudiosMc",
       'AuthorEmail' => '[email protected]com',
       'AuthorUrl' => 'https://vizionmc.com/',
       'MobileFriendly' => TRUE,
    );
    
    public function discussionsController_beforeDiscussionName_handler($sender) {
      $discussion =& $sender->EventArguments['Discussion'];
      $discussion->DateLastComment = $discussion->DateInserted;
    }
    
    ?>
    
  • R_JR_J Ex-Fanboy Munich Moderator

    Not bad!

    <?php if (!defined('APPLICATION')) exit();
    
    // Define the plugin:
    $PluginInfo['VizionHooks'] = array(
       'Name' => 'VizionHooks Plugin',
       'Description' => 'VizionHooks Plugin. All brain work done by hgtonight - many thanks to him!',
       'Version' => '1.0',
       'Author' => "VizionStudiosMc",
       'AuthorEmail' => '[email protected]',
       'AuthorUrl' => 'https://vizionmc.com/',
       'MobileFriendly' => TRUE
    );
    
    class VizionHooksPlugin extends Gdn_Plugin {
      public function discussionsController_beforeDiscussionName_handler($sender) {
        $discussion =& $sender->EventArguments['Discussion'];
        $discussion->DateLastComment = $discussion->DateInserted;
      }
    }
    

    Deleted the "," in line 11
    Added class in line 14
    Deleted closing ?>

    But I do not have a clue if this will be working as you expect it, but since you simply copied @hgtonight, I guess it's working flawlessly


    hgtonightVizionStudios
  • The plugin did not work :confused:

    It should not update Most recent by or The time it was post.

  • hgtonighthgtonight ∞ · New Moderator

    @VizionMc said:
    The plugin did not work :confused:

    It should not update Most recent by or The time it was post.

    My crystal ball clearly needs some polishing.

    I am confused as to what you are trying to achieve. I believe a screenshot and detailed explanation is in order.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.