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.

How to move first voting element?

Hi! I wish to change the position of the first voting element when viewing a discussion. I want to only move the voting element linked to the main thread, not the comments.
Is there any way to create an unique css class for the first voting element?

I need this to get a smooth fit with my theme :)

Comments

  • peregrineperegrine MVP
    edited December 2012

    css example for the first element. will modify color - add what you need.

    .FirstComment span.Votes span, .FirstComment span.Votes a {
        background: green !important ;
        }
    

    kasper had a discussion on css with respect to positioning and voting plugin, but you would need to search for that.

    plugin mod for first comment vote position in class.voting.plugin.php
    
    
            copy the contents of the   DiscussionController_BeforeCommentMeta_Handler
            and change the function name to DiscussionController_CommentInfo_Handler
            with the following lines on top.
    
    
    
    
         public function DiscussionController_CommentInfo_Handler($Sender) {
                  //add to  display  only on first discussion comment
                $CssItem = $Sender->EventArguments['CssClass'];
                if (!strpos($CssItem, "FirstComment")) {
                 return;  
                }
    
    
    
        then add  the following lines to the  DiscussionController_BeforeCommentMeta_Handler
    
    
        public function DiscussionController_BeforeCommentMeta_Handler($Sender) {
                       //add to prevent display on first comment
                $CssItem = $Sender->EventArguments['CssClass'];
                if (strpos($CssItem, "FirstComment")) {
                 return;  
                }
                        // end add to prevent display on first comment
    

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

  • Hi, peregrine!

    I followed all your steps: copy and paste the "DiscussionController_BeforeCommentMeta_Handler" function, change name of the function to "DiscussionController_CommentInfo_Handler", add code to the top of the function. Add more code to the "DiscussionController_BeforeCommentMeta_Handler" function.

    I managed to change the colours.

    I then tried to change the positioning by using the following css code taken from kasper's example:

    ul.MessageList div.Meta span.Votes { right: 15px !important; }

    But still all elements gets affected by the change in the css code.

    How do I change the positioning of only the first element?

    I also tried the following code without success:

    .FirstComment ul.MessageList div.Meta span.Votes { right: 15px !important; }

  • peregrineperegrine MVP
    edited December 2012

    I followed all your steps: copy and paste the "DiscussionController_BeforeCommentMeta_Handler" function, change name of the function to "DiscussionController_CommentInfo_Handler", add code to the top of the function. Add more code to the "DiscussionController_BeforeCommentMeta_Handler" function.

    the plugin change I suggested should move the positioning based on the event you triggered on, you could try other events. different versions of vanilla have different events. You could also add a custom event in your helper functions.

    As far as positioning with css - you would have to experiment.

    But you now know how to identify the .FirstComment with css, maybe you've gained some insights. maybe not.

    maybe if you specify your theme or post a link to your site, a css positioning expert will come knocking on your door. Personally, I find css positioning tedious, so beyond some hints above that is about all I've got.

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

Sign In or Register to comment.