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.
Options

how can i allow hompage public,but discussion page private?

edited November 2011 in Vanilla 2.0 - 2.8
that means:
people can see the content of homepage without login,
but they can't see the content of discussion page before login, when they open a discussion url, they are redirected to the login page.


i think maybe add some code to the discussion php(applications/vanilla/views/discussion/index.php) code, to Judgment if users are logined.

but i don't know how, can anyone help me? thanks.

Answers

  • Options
    This can be done with permissions. in dashboard go to roles and permissions, then for guest uncheck view where it corresponds to to discussion.

    grep is your friend.

  • Options
    This can be done with permissions. in dashboard go to roles and permissions, then for guest uncheck view where it corresponds to to discussion.
    @x00 i know what you mean, but i want allow the guest see homepage, i setting as you, the guest can't see the content of homepage with discussion tittle list& meta things.
  • Options
    yes you can with the right permissions

    grep is your friend.

  • Options
    If you are asking for the ability for people to see the discussion lists, but be unable to click a link to read the contents of a discussion until they log in... I don't think there's currently a way to do that with the roles and permissions.

    But you can use permissions to prevent people from being able to read (won't show up in discussion lists) categories unless they have the correct role (being logged in is a role)

    There was an error rendering this rich post.

  • Options
    x00x00 MVP
    edited November 2011
    Ok I would check

    Permission('Vanilla.Discussions.Add'); that is becuase what you are saying is those that can't add shouldn't view. This may redirect to "not authorised" page rather than login. CheckPermission will give a Boolean result.

    Don't edit the core

    You could use Discussion_BeforeRender_Handler, this isn't that efficient becuase you are doing work then discarding it. As would be the case if you used a view.

    So the more efficient way to do it is use the hook Dispatcher_AfterAnalyzeRequest_Handler then check if(strtolower($Sender->OriginalRequestMethod)!='discussion') return; So we are dealing with discussion. Then your $Sender->Permission('Vanilla.Discussions.Add'); or
    if(!$Sender->CheckPermission('Vanilla.Discussions.Add') && 
    $Sender->DeliveryType() == DELIVERY_TYPE_ALL){
    Redirect('/entry/signin?Target='.urlencode($Sender->SelfUrl));
    }
    whichever works best for you. Read up on plugins / themehooks if you haven't already.




    grep is your friend.

Sign In or Register to comment.