Roundcube Community Forum

 

Conditional add calendar button

Started by amuniz, September 26, 2011, 08:09:41 AM

Previous topic - Next topic

amuniz

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.

rosali

$_SESSION['username'] should be available everywhere when the user is logged in.
Regards,
Rosali

amuniz

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.