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.
Vanilla variables used in Custom Page
Best Answers
-
sahotataran ✭✭✭
yes you can use all variables, Classes, Functions from vanilla in custom pages.
There was an error rendering this rich post.
1 -
sahotataran ✭✭✭
$Session = Gdn::Session(); if ($Session->IsValid()) { $userid = $Session->UserID; $Name = $Session->User->Name; }
above can be used to check if session is valid i.e user is logged in. then u can get his username and userid. then using userid u can check for function in UserModel to get the userdetails from ID or USERNAME. i suppose that you are familiar with programming and u can go through the code to find out what details u want - i have given u userid and username.
i tried $this->AddModule('CategoriesModule'); but it doesnot seem to work on mine. u can try on your install if it works for u
There was an error rendering this rich post.
0
Answers
yes you can use all variables, Classes, Functions from vanilla in custom pages.
There was an error rendering this rich post.
Well.. so how can I use them? I made a Custom Page with
var_dump(get_defined_vars());
and I don't see there any user or other useful data..
i created a page demo.php in custom pages plugin and put
which set the title of page as Set above and printed out the first 10 discussions.
what kind of data you want to print? - you will have to look for variable in core and echo it out or var_dump();
There was an error rendering this rich post.
is there any list of all variables I can view and set in Custom Pages? Especially I want to know if user is logged, his username and avatar image.
Can I make queries in Custom Page? Can I set a default sidebar? Can I set content of own sidebar?
If yes, can anyone tell me how?
above can be used to check if session is valid i.e user is logged in. then u can get his username and userid. then using userid u can check for function in UserModel to get the userdetails from ID or USERNAME. i suppose that you are familiar with programming and u can go through the code to find out what details u want - i have given u userid and username.
i tried $this->AddModule('CategoriesModule'); but it doesnot seem to work on mine. u can try on your install if it works for u
There was an error rendering this rich post.