HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Hide profile from guests.
Anonymoose
✭✭
public function ProfileController_MyProfile_Create($Sender, $Args) { // Check to see if guest. if(Gdn::Session()->UserID == 0){ return FALSE;}
Added this code to hide from all guests.
0
Comments
@Anonymoose:
This seems to lead to a blank page. So probably not the best way.
I added your code on line 60 in the file ~/plugins/MyProfile/default.php
use
throw NotFoundException();
grep is your friend.
@x00: Is it possible to hide it from guests? Where do i need to place "throw NotFoundException();" ?
Thanx
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Thank you peregrine. Works great. By UserID < 1 looks like a logical work around. Just logically this can be done by asking for the role also or?
Not necessarily - a user can have many roles, then you will have a jungle of testing.
If the user is not logged in they have session user id of 0 and are therefore guests.
Although some people have userid of 0 as root in their tables - I think this is an artifact of migrations. and they really shouldn't have a userid of 0 in the user table.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Ah ok, thanx peregrine. Knowledge is power.