Forums: [SOLVED] Hide a menu item after login - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[SOLVED] Hide a menu item after login Rate Topic: -----

#1 User is offline   gehrenfeld 

  • Member
  • PipPip
  • Group: Members
  • Posts: 28
  • Joined: 18-November 15

Posted 19 July 2018 - 12:23 PM

I am trying to hide a menu item once a user logs in. I want to hide the Register menu item.
I looked in the PHPRunner docs and I saw this code. But is crashes when I login.

if ($_SESSION["GroupID"]=="2")

{

  $title = $menuItem->getTitle("Register");

  if ($title=="Register")

     return false;

}

return true;

Gary
0

#2 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 15886
  • Joined: 03-February 03

Posted 19 July 2018 - 01:54 PM

When you say "it crashes", what exactly does it mean? If there is an error message you should post it here.
Best regards,
Sergey Kornilov
0

#3 User is offline   gehrenfeld 

  • Member
  • PipPip
  • Group: Members
  • Posts: 28
  • Joined: 18-November 15

Posted 19 July 2018 - 02:30 PM

View Postadmin, on 19 July 2018 - 06:54 AM, said:

When you say "it crashes", what exactly does it mean? If there is an error message you should post it here.


Here is what I get.

Fatal error: Uncaught Error: Call to a member function getTitle() on null in C:\Bitnami\wampstack-7.1.17-0\apache2\htdocs\cookn\include\events.php:51 Stack trace: #0 C:\Bitnami\wampstack-7.1.17-0\apache2\htdocs\cookn\include\commonfunctions.php(1361): class_GlobalEvents->AfterSuccessfulLogin('garye', '', Array, Object(LoginPage)) #1 C:\Bitnami\wampstack-7.1.17-0\apache2\htdocs\cookn\classes\loginpage.php(711): SetAuthSessionData('garye', Array, false, '', Object(LoginPage), true) #2 C:\Bitnami\wampstack-7.1.17-0\apache2\htdocs\cookn\classes\loginpage.php(176): LoginPage->LogIn('garye', '') #3 C:\Bitnami\wampstack-7.1.17-0\apache2\htdocs\cookn\classes\loginpage.php(126): LoginPage->doLoginRoutine() #4 C:\Bitnami\wampstack-7.1.17-0\apache2\htdocs\cookn\login.php(128): LoginPage->process() #5 {main} thrown in C:\Bitnami\wampstack-7.1.17-0\apache2\htdocs\cookn\include\events.php on line 51

Gary
0

#4 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 15886
  • Joined: 03-February 03

Posted 19 July 2018 - 02:37 PM

What event do you add this code to? Screenshot of the full PHPRunner window please with this code being open.
Best regards,
Sergey Kornilov
0

#5 User is offline   gehrenfeld 

  • Member
  • PipPip
  • Group: Members
  • Posts: 28
  • Joined: 18-November 15

Posted 19 July 2018 - 05:40 PM

View Postadmin, on 19 July 2018 - 07:37 AM, said:

What event do you add this code to? Screenshot of the full PHPRunner window please with this code being open.


Login Page

https://www.dropbox....apture.PNG?dl=0
Gary
0

#6 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 15886
  • Joined: 03-February 03

Posted 19 July 2018 - 05:48 PM

Wrong event. Please refer to the manual:
https://xlinesoft.co...item_modify.htm
Best regards,
Sergey Kornilov
0

#7 User is offline   gehrenfeld 

  • Member
  • PipPip
  • Group: Members
  • Posts: 28
  • Joined: 18-November 15

Posted 19 July 2018 - 06:45 PM

View Postadmin, on 19 July 2018 - 10:48 AM, said:

Wrong event. Please refer to the manual:
https://xlinesoft.co...item_modify.htm

That worked. I spent a whole day looking on how to do that and never knew there was menu modify event.

Thank you for your help.
Gary
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic