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

Whats the deal with $Sender->InformMessage( "my message" , "AutoDismiss"); to get it to display.

peregrineperegrine MVP
edited June 2013 in Feedback

Sometimes it works in some instances (as in displaying a message) in plugins and most of the time it doesn't on local installation while testing plugins..

Is there a set of parameters that need to be followed?
I assume you have to remain on the same page for it work. But it is baffling to me. Does it only work after a form is saved or some such instance.

Any insights??

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

Comments

  • lifeisfoolifeisfoo Zombie plugins finder ✭✭✭

    Can you provide examples (working and not working)?

    There was an error rendering this rich post.

  • hgtonighthgtonight ∞ · New Moderator

    In 2.0.18.8, InformMessages are handled in 2 different ways.

    First, the message stack is inserted as an encoded form definition through PHP. global.js picks this up and interprets it as the inform message.

    Secondly, any JS code can add to the stack which will render the whole stack. Indeed, there is a check for inform messages every minute in global.js.

    It would be helpful if you could narrow it down to a PHP issue or a JS issue.

    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.

  • thx for the feedback. when I isolate a case I'll post it.

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

  • Different question relating to inform question.

    @hgtonight, @lifeisfoo

    What I was trying to do was send a message from inside a function inside my model in a plugin (just a kind of disappearing echo of variables as it steps through routine.) I thought I might be able to use. Gdn::Controller()-> , since Sender and this is not applicable.

    Gdn::Controller()->InformMessage( "My test message" , "AutoDismiss");

    faulty logic maybe ?????

    not sure if it can be used this way - but my goal was this - but does not work.....

    e,g,  in Testing Plugin   default.php
    
    I call 
    
      $Sqlresults = $TestingModel->UpdateMyTest($ABC,$DEF);
    
    
    
    
    
    inside the class.testingmodel.php
    
    public function UpdateMyTest($ABC,$DEF) {
    
               Gdn::Controller()->InformMessage( "But, $ABC will not display a message");  
    
    
               echo "whereas $DEF the echo statement works so the plugin model of this function works";
    
    
      ....  my sql function works....
              .....
              return $Sqlresults  
    }
    

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

  • hgtonighthgtonight ∞ · New Moderator

    I can tell you why that won't work. The Gdn_Controller class doesn't do anything with the messages until it is rendered (which won't happen since this is a one off controller).

    Looking at /library/core/class.statistics.php for inspiration, you can see that it is a plugin that uses Gdn::Controller()->InformMessage(). Notice that SettingsController_AnalyticsTick_Create(&$Sender) calls it (through Tick()) and then renders out the json view:

    Gdn::Statistics()->Tick();
    $Sender->DeliveryType(DELIVERY_TYPE_VIEW);
    $Sender->DeliveryMethod(DELIVERY_METHOD_JSON);
    $Sender->Render('tick','statistics','dashboard');
    

    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.

  • peregrineperegrine MVP
    edited June 2013

    @hgtonight

    It's still a cargo cult programming experience that you are shedding more light on :).

    just goofing around I can emulate it - but the autodismiss doesn't work. I'm still in the dark as to how to make it work if possible inside here, without rewriting everything from scratch.

    It would be nice to be able to inform from within a model.

    public function UpdateMyTest($ABC,$DEF) {

    echo     '<div class="InformMessage  AutoDismiss ">';
    
      echo     ' <span class="InformSprite Skull Dismissable"></span>';
      echo "here";
       echo "    </div>"
    

    }

    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.