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

Move date on discussion to below paragraph text

Greetings, here comes another of my weird questions 😅 I wonder if and if so how I can move the date, May 16 in this picture, to below the posted text (which end with Thank you in the picture example).

I'm not familar with PHP so I couldn't figure something out from it. Basically I'd like to change the order of the HTML markup so this meta element appear below the text. I had a try using CSS flex-box order, but I wasn't successful with it. I'm using Vanilla 3.3 with Keystone.

Thank you!


  • Options

    I was able to edit a copy of the file discussion.php located in applications/vanilla/views/discussion. The section I needed to edit was pretty much HTML so it was doable. This only edits the HTML structure for the discussion creator though.

    I've not found any file in the folder or in any of the other folders to do the same with comments. Perhaps it's not as simple so I don't see it. Anyone have any idea?

    Thank you in advance.

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    You really better should write a plugin for that. There is no easy way not to print out the date in the discussion/comment meta so the cleanest way is to hide it with .Meta .MItem.DateCreated {display: none} or something like that.

    In your plugin you should have two methods

    1. discussionController_afterCommentBody_handler($sender, $args) {} and that should be used to mimic what is happening in /applications/vanilla/views/discussion/helper_functions.php writeComment() method (you can access the comments information with $args['Comment'])
    2. discussionController_afterDiscussionBody_handler($sender, $args) {} with the same approach as the above

  • Options

    Thanks for you answer :)

    I do want to display the date, otherwise I'd just hide it as you said. If possible I'd just like to change the order of the HTML structure so that it appears below the 'comment', like in this picture

    I was able to do this by changing discussion.php, change the order of the divs in it which changed the HTML structure. But discussion.php only changes the the first post. I take it it might not be as easy to do the same for comments.

  • Options

    Edit: all good now :)

    I'm a bit slow, but decided to have a look in helper_functions.php since you kind of pointed out it has something to do with the meta. And there it was. Was able to edit the structure of the divs there. Seem like the forum is still working too :P

  • Options
    R_JR_J Ex-Fanboy Munich Admin

    Not as good as you think... With the next update all of your changes are lost. That's what a theme (or a plugin) is good for.

    I have tried to give 2 hints: 1st how to hide the date in the meta and 2nd how to show it in the "footer". I might have not been clear enough.

    • There is no way to move that block.
    • You can't get rid of the date in the meta, therefore you have to hide
    • You can insert arbitrary text below the post text by using the above mentioned methods in a plugin or theme
    • In order to know what code you need to get that result I referenced the file
    • Never change files to customize anything since that is a one way street and will you keep from using updates
    • Customization is done by adding a plugin or a theme, look at the documentation or simple plugins in order to get started
    • Ask if you get stuck
  • Options

    That's what a theme (or a plugin) is good for

    Oh the edited files are in themes/mythemename/views/discussion. So they shouldn't get lost from what I understand. Have to redo if Keystone updates though, which the theme is based on.

    A plugin would be neat, but there's no way I can write one or learn how to write one right now at least.

    There is no way to move that block.

    It seemed possible to me once I figured out which files and didn't get so scared by the php. The markup is changed and it seem to be working fine. Here you can see I moved the Meta.DiscussionMeta to just above Reactions. I did the same for Meta.CommentMeta:

    Wihtout editing it looks this way, where Meta.DiscussionMeta is above Item-BodyWrap:

    So far it seems it's working well. Sorry my English isn't so good so I'm probably confusing you. I didn't intend to remove or hide the meta at all, just move it by changing the HTML markup which seem to have worked once I dared dig into the PHP files.

  • Options
    ElleElle New
    edited May 2020

    Edit: double comment. The first one disappeared after correcting some spelling and didn't reappeared until I posted again.

Sign In or Register to comment.