From: Thomas Tanghus Date: Tue, 17 Jul 2012 01:04:04 +0000 (+0200) Subject: Added hook for postCreateUser. Probably fix for oc-1265. X-Git-Tag: v4.0.5~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f4a8c233cf88bb36203b3104cc587a479bdd33c2;p=nextcloud-server.git Added hook for postCreateUser. Probably fix for oc-1265. Conflicts: apps/calendar/appinfo/app.php --- diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index b02fc602c6b..48c346e8ad3 100644 --- a/apps/calendar/appinfo/app.php +++ b/apps/calendar/appinfo/app.php @@ -7,6 +7,9 @@ OC::$CLASSPATH['OC_Calendar_Hooks'] = 'apps/calendar/lib/hooks.php'; OC::$CLASSPATH['OC_Connector_Sabre_CalDAV'] = 'apps/calendar/lib/connector_sabre.php'; OC::$CLASSPATH['OC_Calendar_Share'] = 'apps/calendar/lib/share.php'; OC::$CLASSPATH['OC_Search_Provider_Calendar'] = 'apps/calendar/lib/search.php'; + +//General Hooks +OCP\Util::connectHook('OC_User', 'post_createUser', 'OC_Calendar_Hooks', 'createUser'); OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser'); OCP\Util::addscript('calendar','loader'); OCP\Util::addscript("3rdparty", "chosen/chosen.jquery.min"); diff --git a/apps/calendar/lib/hooks.php b/apps/calendar/lib/hooks.php index 328d2951d23..bc0b02c62b8 100644 --- a/apps/calendar/lib/hooks.php +++ b/apps/calendar/lib/hooks.php @@ -11,7 +11,18 @@ */ class OC_Calendar_Hooks{ /** - * @brief Deletes all Addressbooks of a certain user + * @brief Creates default calendar for a user + * @param paramters parameters from postCreateUser-Hook + * @return array + */ + public static function createUser($parameters) { + OC_Calendar_Calendar::addCalendar($parameters['uid'],'Default calendar'); + + return true; + } + + /** + * @brief Deletes all calendars of a certain user * @param paramters parameters from postDeleteUser-Hook * @return array */