Roundcube Community Forum

Third Party Contributions => API Based Plugins => Topic started by: amuniz on September 26, 2011, 08:09:41 AM

Title: Conditional add calendar button
Post by: amuniz 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.
Title: Conditional add calendar button
Post by: rosali on October 04, 2011, 01:12:02 AM
$_SESSION['username'] should be available everywhere when the user is logged in.
Title: Conditional add calendar button
Post by: amuniz 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.