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

sidepanel navigation; show only if user is signed in

jackmaessenjackmaessen ✭✭✭
edited December 2014 in Feedback

I am using this plugin and i noticed that when no one is logged in, the Participated Discussion is also shown in the sidepanel. This seems not very logic to me.

In class.participated.plugin.php file there is this piece of code which displays the nav link in the sidebar. I put 2 lines to it so that it is only being diplayed when user is logged in (these lines are marked with --> ADDED

   /**
    * New navigation menu item.
    *
    * @since 2.1
    */
   public function Base_AfterDiscussionFilters_Handler($Sender) {
      if (Gdn::Session()->IsValid()) { // check if the user is signed in, otherwise do not show in side navigation  -->ADDED
      // Participated
      $CssClass = 'Participated';
      if (strtolower(Gdn::Controller()->ControllerName) == 'discussionscontroller' && strtolower(Gdn::Controller()->RequestMethod) == 'participated')
         $CssClass .= ' Active';
      echo '<li class="'.$CssClass.'">'.Anchor(Sprite('SpParticipated').T('Participated'), '/discussions/participated').'</li>';
   } // endif garden session -->ADDED
   } 

Comments

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited December 2014
    public function Base_AfterDiscussionFilters_Handler($Sender) {
           if(Gdn::Session() && !$Session->IsValid()) {
                return;
    
  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited December 2014

    That is a guess but let me see the plugin, hmm that is a very old plugin and it does check for logged in users.

    Did you fix the Senders ?

    replaced &$Sender for $Sender ?

  • Options

    if (! Gdn::Session()->IsValid() ) return;

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

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    if (!Gdn::Session()->IsValid()) throw new Exception(T("Could not get participated discussions for non logged-in user."));

    and here too

    public function DiscussionsController_Participated_Create($Sender, $Args) {
          $Sender->Permission('Garden.SignIn.Allow');
    
  • Options

    if someone seconds the plugin as working it would be updated.

    unfortunately no one can second it.

    http://vanillaforums.org/discussion/comment/220781/#Comment_220781

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

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    Ok , so do you have a zip of the fix ? I can only test my own fixes. If it amounts to the senders being the only issue.

  • Options

    @peregrine That's right; this plugin is not working properly under 2.1.6. I took the plugin from the master you mentioned on Github. That one works perfectly but the sidebar nav was the only issue i noticed, so i put the if statement in it

  • Options
    peregrineperegrine MVP
    edited December 2014

    and the plugin to me works as you would want it to work.

    Participated 1.1.0 from github.

    if someone seconds the plugin as working it would be updated.

    unfortunately no one can second it.

    http://vanillaforums.org/discussion/comment/220781/#Comment_220781

    if you click on participated it takes you to signin page just as other things do.

    but if jack doesn't want to see it....

    the only reasonable change but still senseless to me

    public function Base_AfterDiscussionFilters_Handler($Sender) {
    if (! Gdn::Session()->IsValid() ) return;  // participated link for guests.
    

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

  • Options

    When i do not put the if statement in it, i see it like this: http://forum.webprofis.nl/
    On the right side: "Mijn Topics Deelname" = "My Participated Discussions"

  • Options
    peregrineperegrine MVP
    edited December 2014

    @jackmaessen said:
    When i do not put the if statement in it, i see it like this: http://forum.webprofis.nl/
    On the right side: "Mijn Topics Deelname" = "My Participated Discussions"

    and it is an incentive to login.... just a hint of a feature available.

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

  • Options
    peregrineperegrine MVP
    edited December 2014

    @vrijvlinder said:
    Ok , so do you have a zip of the fix ? I can only test my own fixes. If it amounts to the senders being the only issue.

    it is fixed if you just download this file you can extract.

    https://github.com/vanilla/addons/archive/master.zip

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

  • Options
    jackmaessenjackmaessen ✭✭✭
    edited December 2014

    @‌peregrine
    For me personal, it is not logic. When an outsider visits your forum, he can click and navigate on the other 3 ones ( categories, recent topics and activities) in the sidepanel. Only this one forces him to login. And when he does not have an account, he cannot use the link; so it is useless for him....oke that's my opinion

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited December 2014

    Ok I tested ( yes the zipped version )it and it works I added the check so it does not show in the side menu and it works . I will second ...

  • Options
    peregrineperegrine MVP
    edited December 2014

    @jackmaessen

    to each his own.

    perhaps you can send @linc a message since you tested and just tell him gihub version of Participated 1.1.0 works for you an you want to second it!

    simple enough!

    since you can't add to the discussion in a developer category, because you are not in developer role (or rank).

    and the plugin will get moved to the add-ons section to make it easier for everyone, if the goal is to make things easy. if the goal is to make things hard then leave things as status quo.

    http://vanillaforums.org/discussion/28516/getting-updated-versions-of-addons-in-the-org-directory/p1

    http://vanillaforums.org/discussion/comment/220781/#Comment_220781

    re-read!

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

  • Options

    i will do that, good hint

Sign In or Register to comment.