Users running a non-download version of Vanilla (pulled from github), on branch release/2019.016 or master from the last 2 weeks should upgrade to release/2019.017 or latest master for security reasons. Downloaded official open sources releases are not affected.

Messages Feature Request - only users not logged in to view

A simple feature request, I'd appreciate the ability to display site-wide messages only to users who are not currently logged in.

Comments

  • just create a new category. add an annnouncement. And give the category custom permissions which reflect that only guests can view and no one else has viewing capability.

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

  • or use a plugin like forumdonate - put a message in it and make it viewable only if not logged in.

    http://vanillaforums.org/addon/forumdonate-plugin

    see the readme on how to modify message.

    and

    change
     public function Base_Render_Before($Sender) {
    

    to

       public function Base_Render_Before($Sender) {
      $Session = Gdn::Session();
      if ($Session->UserID > 0)  return;
    

    the panel will disappear when you login and appear when you logout.

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

    R_J
  • hgtonighthgtonight ∞ · New Moderator

    That seems like a reasonable feature request for core functionality, IMO.

    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.

  • I could do a workaround with the LoginRadius plugin which allows you to set text around there, but a built in Messages feature would be nice :)

  • hgtonighthgtonight ∞ · New Moderator

    I think @peregrine's suggestion would be pretty easy to work with, if you need it immediately.

    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.

  • Does anybody know if this feature request has implemented?

    I think this would be a great feature to have.

  • @gohunter said:
    Does anybody know if this feature request has implemented?

    I think this would be a great feature to have.

    if you don't make request on github the odds are low.

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

  • Ahh, I found this thread just now and thought since it was old, this had chance. Maybe I will request it on the github then. Thanks.

  • peregrineperegrine MVP
    edited October 2014

    another way to do it is write a plugin that adds css to to certain message classes

    so choose "Casual" in the messages dashboard.

    e.g. hide "Casual Messages" for logged in users

    plugins/HideCasual/default.php

    <?php if (!defined('APPLICATION')) exit();
    
    
    $PluginInfo['HideCasual'] = array(
       'Name' => 'HideCasual',
       'Description' => 'Only display causal Messages for users that are not signed in.',
       'Version' => '1.0',
       'MobileFriendly' => TRUE,
       'Author' => "P"
    );
    
    class HideCasualPlugin extends Gdn_Plugin {
    
    
       public function AssetModel_StyleCss_Handler($Sender) {
       var_dump("hello");
       $Session = Gdn::Session();
       if ($Session->IsValid() ) {
        $Sender->AddCssFile('hidecasual.css', 'plugins/HideCasual');
       }
    }
    }
    

    plugins/design/HideCasual/hidecasual.css

    div .CasualMessage {
    display:none !important;
    }
    

    NOTE: obviously this just hides via css, so don't put anything in the message that is really confidential, only something you just don't want to display for cosmetic purposes.

    other wise the panel option above is a better method for secure messages.

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

    gohuntervrijvlinder
  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    @peregrine: you are providing so many solutions, that you forget which problems you've already solved before ;)

    http://vanillaforums.org/discussion/27073/tip-showing-pockets-to-guest-for-specific-pocket-locations-in-vanilla-2-1#latest


    peregrinegohunter
  • peregrineperegrine MVP
    edited October 2014

    yes, that solution by anonymoose, is a very clean one and perhaps the best.

    especially if you re-use the pocket name. then you only have to make change in tpl file once.

    the "Casual" could be a generic to Casual messages, without need to modify .tpl

    I guess it all depends how often you do things, what you want to do. forum owner's choice.

    all the examples - just exemplify the power and flexibility of vanilla, and many ways to solve something. :wink:

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

    R_Jgohunter
Sign In or Register to comment.