Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Unique Style for Discussion Starter

edited June 2008 in Vanilla 1.0 Help
Hey guys, just a few weeks back I posted a discussion regarding styling the first post of a discussion - CSS Styling the first post.

While still in the design stages for my forum, I had an idea but not sure if it's possible to implement, and if it is, how? Basically I'd like it so that for each discussion, the member who starts the discussion to have a unique first post style, for example a light red background or something along those lines, nothing overly complicated. For every other post in the discussion, the normal style would apply. However, whenever the original discussion starter makes another post within the discussion, I would like it for the original first post style to apply. I'm not really sure whether my description's clear enough to understand but I can provide basic mockups to show what I mean if required.

As far as I know, theoretically, a check would have to be made to see whether the poster id is equal to the id of the member who started the discussion. If true, then that style applies, else default style would show. I'm not much of a programmer so I have no idea where to start or anything, but I'm pretty fluent with the client-side end of things. It's just that if PHP is involved, I can work my way around with no problems at all, I just can't hand code myself as well as I'd like to haha!

Looking forward to seeing what you guys have in mind about this sort of idea and if anyone could guide me on how I can achieve this. Many thanks in advance.

Comments

  • edited June 2008
    I see a few ways of doing this:
    • You write a delegate function (CommentGrid, PostCommentOptionsRender) that uses some sort of string function (str_replace(), probably) to add a css class to the first comment, as determined by the $RowNumber delegate parameter comment. This has the advantage that admins just need to enable the extension and go.
    • You write a new theme file does the same function as above. Doing this would probably be easier and more efficient, wouldn't necessarily be compatible with all themes.
    • You write some sort of javascript that changes the DOM, but I'm not great with javascript, so I can't help you there.
    EDIT: I really should read the post fully before responding.

    Here's what you do: Write either a delegate function or a new theme file that checks $Comment->AuthUserID with $CommentGrid->Discussion->AuthUserID. If they are the same, add a css class as outlined above.
  • I like the idea of this. You could combine in some kind of indication of a user's role with this as well — in some communities it's nice to be able to see the police ;)
  • I know I may have some laughter coming my way but as I mentioned, I'm not much of a programmer as such purely because my interests lie in the design aspects of the web - what's a delegate function and where do I write one? Also is there any sample delegate functions I could have a look at for a better understanding of how they work? Sorry! :x
  • Resilient[W]hat's a delegate function and where do I write one? Also is there any sample delegate functions I could have a look at for a better understanding of how they work?
    Check out the documentation section (here at lussumo.com). The delegation system that Mark came up with basically allows extension writers to insert their own custom functions in the middle of the core Vanilla files.
This discussion has been closed.