function celebrations_init() { elgg_register_library('celebrations_lib', elgg_get_plugins_path() . 'celebrations/lib/celebrations_lib.php'); elgg_load_library('celebrations_lib'); if (elgg_get_plugin_setting("ViewReminder", "celebrations") == 'yes') { elgg_register_event_handler('login:after', 'user', 'show_next_celebrations'); } elgg_register_plugin_hook_handler('profile:fields', 'profile', 'celebrations_profile_fields_plugin_handler'); if (elgg_is_logged_in()) { elgg_register_menu_item('site', array('name' => 'celebrations', 'text' => elgg_echo('celebrations:shorttitle'), 'href' => "celebrations/celebrations")); } // Extend system CSS elgg_extend_view('css/elgg', 'celebrations/css'); // Register a page handler, so we can have nice URLs elgg_register_page_handler('celebrations', 'celebrations_page_handler'); //add widgets elgg_register_widget_type('today_celebrations', elgg_echo("today_celebrations:title"), elgg_echo("today_celebrations:description")); elgg_register_widget_type('next_celebrations', elgg_echo("next_celebrations:title"), elgg_echo("next_celebrations:description")); //add index widgets for Widget Manager plugin elgg_register_widget_type('index_today_celebrations', elgg_echo('today_celebrations:title'), elgg_echo('today_celebrations:description'), array("index")); elgg_register_widget_type('index_next_celebrations', elgg_echo('next_celebrations:title'), elgg_echo('next_celebrations:description'), array("index")); elgg_register_plugin_hook_handler("entity:url", "object", "celebrations_widget_urls"); elgg_register_action('celebrations/settings/save', elgg_get_plugins_path() . "celebrations/actions/celebrations/settings.php", 'admin'); if (elgg_is_active_plugin('profile_manager')) { $profile_options = array("show_on_register" => "no", "mandatory" => "no", "user_editable" => "yes", "output_as_tags" => "no", "admin_only" => "no", "count_for_completeness" => "yes"); profile_manager_add_custom_field_type("custom_profile_field_types", "day_anniversary", "day_anniversary", $profile_options); profile_manager_add_custom_field_type("custom_profile_field_types", "yearly", "day_anniversary", $profile_options); } }
/** * Registes all custom field types * * @return void */ function profile_manager_register_custom_field_types() { // registering profile field types $profile_options = array("show_on_register" => true, "mandatory" => true, "user_editable" => true, "output_as_tags" => true, "admin_only" => true, "count_for_completeness" => true); $location_options = $profile_options; unset($location_options["output_as_tags"]); $dropdown_options = $profile_options; $dropdown_options["blank_available"] = true; $radio_options = $profile_options; $radio_options["blank_available"] = true; //$file_options = array( // "user_editable" => true, // "admin_only" => true //); $pm_rating_options = $profile_options; unset($pm_rating_options["output_as_tags"]); $social_options = $profile_options; $social_options['output_as_tags'] = false; profile_manager_add_custom_field_type("custom_profile_field_types", 'text', elgg_echo('profile:field:text'), $profile_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'longtext', elgg_echo('profile:field:longtext'), $profile_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'tags', elgg_echo('profile:field:tags'), $profile_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'location', elgg_echo('profile:field:location'), $location_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'url', elgg_echo('profile:field:url'), $profile_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'email', elgg_echo('profile:field:email'), $profile_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'date', elgg_echo('profile:field:date'), $profile_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'calendar', elgg_echo('calendar'), $profile_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'dropdown', elgg_echo('profile_manager:admin:options:dropdown'), $dropdown_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'radio', elgg_echo('profile_manager:admin:options:radio'), $radio_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'multiselect', elgg_echo('profile_manager:admin:options:multiselect'), $profile_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'pm_rating', elgg_echo('profile_manager:admin:options:pm_rating'), $pm_rating_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'pm_twitter', elgg_echo('profile_manager:admin:options:pm_twitter'), $social_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'pm_facebook', elgg_echo('profile_manager:admin:options:pm_facebook'), $social_options); profile_manager_add_custom_field_type("custom_profile_field_types", 'pm_linkedin', elgg_echo('profile_manager:admin:options:pm_linkedin'), $social_options); //profile_manager_add_custom_field_type("custom_profile_field_types", 'pm_file', elgg_echo('profile_manager:admin:options:file'), $file_options); // registering group field types $group_options = array("output_as_tags" => true, "admin_only" => true); $dropdown_options = $group_options; $dropdown_options["blank_available"] = true; $radio_options = $group_options; $radio_options["blank_available"] = true; $location_options = $group_options; unset($location_options["output_as_tags"]); profile_manager_add_custom_field_type("custom_group_field_types", 'text', elgg_echo('profile:field:text'), $group_options); profile_manager_add_custom_field_type("custom_group_field_types", 'longtext', elgg_echo('profile:field:longtext'), $group_options); profile_manager_add_custom_field_type("custom_group_field_types", 'tags', elgg_echo('profile:field:tags'), $group_options); profile_manager_add_custom_field_type("custom_group_field_types", 'url', elgg_echo('profile:field:url'), $group_options); profile_manager_add_custom_field_type("custom_group_field_types", 'email', elgg_echo('profile:field:email'), $group_options); profile_manager_add_custom_field_type("custom_group_field_types", 'date', elgg_echo('profile:field:date'), $group_options); profile_manager_add_custom_field_type("custom_group_field_types", 'location', elgg_echo('profile:field:location'), $location_options); profile_manager_add_custom_field_type("custom_group_field_types", 'calendar', elgg_echo('calendar'), $group_options); profile_manager_add_custom_field_type("custom_group_field_types", 'dropdown', elgg_echo('profile_manager:admin:options:dropdown'), $dropdown_options); profile_manager_add_custom_field_type("custom_group_field_types", 'radio', elgg_echo('profile_manager:admin:options:radio'), $radio_options); profile_manager_add_custom_field_type("custom_group_field_types", 'multiselect', elgg_echo('profile_manager:admin:options:multiselect'), $group_options); }
/** * Called during system init * * @return void */ function birthdays_init() { if (elgg_is_active_plugin("profile_manager")) { // add custom profile field type // only works with Profile Manager active $profile_options = array("show_on_register" => true, "mandatory" => true, "user_editable" => true, "output_as_tags" => false, "admin_only" => true, "count_for_completeness" => true); profile_manager_add_custom_field_type("custom_profile_field_types", "birthday", elgg_echo("brithdays:profile_field:type"), $profile_options); } // register page handler for nice URL's elgg_register_page_handler("birthdays", "birthdays_page_handler"); // extend views elgg_extend_view("user/status", "birthdays/user_status", 600); elgg_extend_view("js/elgg", "birthdays/js/site"); // add widget elgg_register_widget_type("birthdays", elgg_echo("birthdays:widget:title"), elgg_echo("birthdays:widget:description"), array("profile", "dashboard", "groups", "index")); // add group option to show birthdays add_group_tool_option("birthdays", elgg_echo("birthdays:groups:options"), false); elgg_extend_view("groups/tool_latest", "birthdays/group_module"); // register plugin hooks elgg_register_plugin_hook_handler("register", "menu:filter", "birthdays_filter_menu_hook"); elgg_register_plugin_hook_handler("register", "menu:owner_block", "birthdays_owner_block_menu_hook"); elgg_register_plugin_hook_handler("widget_url", "widget_manager", "birthdays_widget_url_hook"); }