Author Topic: Conditional add calendar button  (Read 4114 times)

Offline amuniz

  • Newbie
  • *
  • Posts: 2
Conditional add calendar button
« on: September 26, 2011, 08:09:41 AM »
Hello,

I'm trying to modify calendar plugin (included in myroundcube dist) in order to don't show calendar icon (taskbar) when the current user have not CalDAV account. In order to achieve this I have inmplemented a method "check_caldav_access" which returns true if login to CalDAV backend is OK, or false if login fail.

At this point I'm getting a problem, $_SESSION['username'] is not available at "startup" hook time... so I tried to move the "$this->addButton" call to "login_after" hook, but in that level I can not modify UI (addButton has no effect).

Any ideas?

Thanks,
Antonio.

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Conditional add calendar button
« Reply #1 on: October 04, 2011, 01:12:02 AM »
$_SESSION['username'] should be available everywhere when the user is logged in.
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline amuniz

  • Newbie
  • *
  • Posts: 2
Conditional add calendar button
« Reply #2 on: October 04, 2011, 03:39:16 AM »
Hi rosali,

Thanks for your answer.
It's courious, startup hook is triggered two times, first time $_SESSION['username'] is not set, but yes at second time... I don't understand this behaviour, so I've used the afterLogin hook + async command (AJAX) to achieve my objective (hide the calendar icon when user has no CalDAV access).

Thanks again,
Antonio.