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.

Change where messages are rendered

jspautschjspautsch ✭✭✭
edited October 2011 in Vanilla 2.0 - 2.8
I'd like to change the messages to render before the content wrapper instead of inside it, but I can't seem to figure out where this is handled in the code. Anyone have any tips or ideas?
Tagged:

Best Answer

  • jspautschjspautsch ✭✭✭
    Answer ✓
    Hmmm, looks like modules get added to an array, along with all other content, and then that array is dumped into the Content div.

    I think I can use the BeforeAddModule event (under Gdn_Controller->AddModule()) to grab the module content and print it out using a custom event I placed before the content div in my theme's default.master.tpl. However, I'm having trouble getting the arguments from AddModule. I tried $Sender->Module but that didn't seem to work, and I also tried GetValue('Module',$Args) after adding an $Args parameter to my handler function, but that doesn't seem to work either. Any tips?

Answers

  • Hi @jspautsch

    i use a plugin called Pockets - the main advantage is it has more areas defined and control where you want to display your message.

    There was an error rendering this rich post.

  • Yeah, I tried that, but I like how Messages are user-dismissible, which in this case is a must.
  • oh then i will try to find out an alternative for it

    There was an error rendering this rich post.

  • UnderDogUnderDog MVP
    edited October 2011
    I'd like to change the messages to render before the content wrapper instead of inside it
    Which messages do you mean? Something like : Today we just updated our excellent forum to version 2.0.19 final that's at the top of the pages (sometimes)?

    There was an error rendering this rich post.

  • jspautschjspautsch ✭✭✭
    edited October 2011
    Specifically the Messages feature in the dashboard (Dashboard > Appearance > Messages), where you can place messages (either static or user-dismissible) either on top of the content wrapper or at the bottom of the panel wrapper.

    I'd like to have a message displayed near the top of the page that users can dismiss. My theme is fixed-width so has a wrapper with content and panel inside of it. Right now the messages are placed inside the content div, but I'd rather have them just outside of the content div (inside the main wrapper).

    I think it's a module, so it's position is determined by AssetTarget being set to either Content or Panel, right?
  • jspautschjspautsch ✭✭✭
    Answer ✓
    Hmmm, looks like modules get added to an array, along with all other content, and then that array is dumped into the Content div.

    I think I can use the BeforeAddModule event (under Gdn_Controller->AddModule()) to grab the module content and print it out using a custom event I placed before the content div in my theme's default.master.tpl. However, I'm having trouble getting the arguments from AddModule. I tried $Sender->Module but that didn't seem to work, and I also tried GetValue('Module',$Args) after adding an $Args parameter to my handler function, but that doesn't seem to work either. Any tips?

  • Any headway on this?

  • I saw the Pockets plugin mentioned in another thread. It's awesome.

  • elpas0elpas0 New
    edited April 2012

    it looks like the beforeAddModule is useless

    this event does not pass any data about module that will be added

    the only thing you can be sure about - some module is added :)

Sign In or Register to comment.