Skip to main content
Comparing Hooks Started by ahrasis · · Read 8640 times 0 Members and 1 Guest are viewing this topic. previous topic - next topic - Topic derived from Re: Profile visitors

Comparing Hooks

Quote from: ahrasis – Last time I checked in 2.1 Beta 1, they have already included a lot more hooks that seems missing in here. I am so sure whether it is good to suggest identifying and suggesting them in here as well so that we can do more hooking and less edits to core.

I'm opening a new topic and will try to list out their beta 3 hooks and ElkArte 1.0 and 1.1 hooks. This opening post will be modified from time to time as to add the hook list extracted.

Based on "integrate_" search, this hooks are from their source files:

Admin.php (4 hits)
Line 443: integrate_admin_include
Line 727: integrate_admin_search
Line 941: integrate_manage_logs

Attachments.php (2 hits)
Line 310: integrate_attachment_upload

BoardIndex.php (1 hit)
Line 137: integrate_mark_read_button

Calendar.php (1 hit)
Line 206: integrate_calendar_buttons

Display.php (9 hits)
Line 150: integrate_display_topic
Line 797: integrate_poll_buttons
Line 842: integrate_display_message_list
Line 1018: integrate_query_message
Line 1286: integrate_display_buttons
Line 1288: integrate_mod_buttons
Line 1486: integrate_prepare_display_context
Line 1521: integrate_download_request

Errors.php (2 hits)
Line 96: integrate_error_types
Line 258: integrate_output_error

Groups.php (1 hit)
Line 62: integrate_manage_groups

Help.php (2 hits)
Line 36: integrate_manage_help
Line 147:   integrate_helpadmin

Likes.php (8 hits)
Line 236: integrate_valid_likes
Line 312: integrate_issue_like_before
Line 422: integrate_issue_like
Line 635: integrate_likes_json_response

Load.php (14 hits)
Line 241: integrate_load_average
Line 272: integrate_pre_include
Line 348: integrate_pre_load
Line 368: integrate_verify_user
Line 463: integrate_verify_tfa
Line 741: integrate_user_info
Line 1243: integrate_load_member_data
Line 1551: integrate_member_context
Line 1988: integrate_simple_actions
Line 2204: integrate_theme_include
Line 2214: integrate_load_theme
Line 3557: integrate_set_avatar_data

Logging.php (1 hit)
Line 434: integrate_log_types

LogInOut.php (3 hits)
Line 357: integrate_other_passwords
Line 558: integrate_login
Line 664: integrate_logout

ManageAttachments.php (10 hits)
Line 63: integrate_manage_attachments
Line 186: integrate_modify_attachment_settings
Line 241: integrate_save_attachment_settings
Line 337: integrate_modify_avatar_settings
Line 363: integrate_save_avatar_settings
Line 588: integrate_attachments_browse
Line 890: integrate_attachment_remove
Line 1109: integrate_remove_attachments
Line 1527: integrate_repair_attachments_nomsg
Line 1893: integrate_approve_attachments

ManageBans.php (2 hits)
Line 83: integrate_manage_bans
Line 729: integrate_load_addtional_ip_ban;

ManageBoards.php (6 hits)
Line 63: integrate_manage_boards
Line 204: integrate_boards_main
Line 303: integrate_edit_category
Line 609: integrate_edit_board
Line 861: integrate_modify_board_settings
Line 888: integrate_save_board_settings

ManageCalendar.php (3 hits)
Line 73: integrate_manage_calendar
Line 379: integrate_modify_calendar_settings
Line 398: integrate_save_calendar_settings

ManageLanguages.php (4 hits)
Line 55: integrate_manage_languages
Line 805: integrate_language_settings
Line 820: integrate_save_language_settings
Line 891: integrate_modifylanguages

ManageMail.php (3 hits)
Line 57: integrate_manage_mail
Line 323: integrate_modify_mail_settings
Line 341: integrate_save_mail_settings

ManageMaintenance.php (3 hits)
Line 96: integrate_manage_maintenance
Line 379: integrate_convert_msgbody

ManageMembergroups.php (7 hits)
Line 64: integrate_manage_membergroups
Line 313: integrate_pre_add_membergroup
Line 330: integrate_add_membergroup
Line 750: integrate_save_membergroup
Line 1200: integrate_view_membergroup
Line 1231: integrate_modify_membergroup_settings
Line 1236: integrate_save_membergroup_settings

ManageMembers.php (4 hits)
Line 40: integrate_manage_members
Line 268: integrate_view_members_params
Line 1112: integrate_activate

ManageNews.php (3 hits)
Line 44: integrate_manage_news
Line 1075: integrate_modify_news_settings
Line 1098: integrate_save_news_settings

ManagePaid.php (3 hits)
Line 72: integrate_manage_subscriptions
Line 509: integrate_delete_subscription
Line 637: integrate_save_subscription

ManagePermissions.php (8 hits)
Line 74: integrate_manage_permissions
Line 989: integrate_modify_permission_settings
Line 1008: integrate_save_permission_settings
Line 1248: integrate_load_permission_levels
Line 1597: integrate_load_permissions
Line 2206: integrate_load_illegal_permissions
Line 2273: integrate_load_illegal_guest_permissions
Line 2301: integrate_post_moderation_mapping

ManagePosts.php (7 hits)
Line 68: integrate_manage_posts
Line 133: integrate_save_censors
Line 164: integrate_censors
Line 222: integrate_modify_post_settings
Line 257: integrate_save_post_settings
Line 314: integrate_modify_topic_settings
Line 330: integrate_save_topic_settings

ManageRegistration.php (3 hits)
Line 75: integrate_manage_registrations
Line 311: integrate_modify_registration_settings
Line 331: integrate_save_registration_settings

ManageScheduledTasks.php (1 hit)
Line 63: integrate_manage_scheduled_tasks

ManageSearch.php (5 hits)
Line 74: integrate_manage_search
Line 105: integrate_modify_search_settings
Line 127: integrate_save_search_settings
Line 169: integrate_modify_search_weights
Line 177: integrate_save_search_weights

ManageSearchEngines.php (3 hits)
Line 61: integrate_manage_search_engines
Line 103: integrate_modify_search_engine_settings
Line 139: integrate_save_search_engine_settings

ManageServer.php (14 hits)
Line 121: integrate_server_settings
Line 167: integrate_general_settings
Line 179: integrate_save_general_settings
Line 233: integrate_database_settings
Line 246: integrate_save_database_settings
Line 314: integrate_cookie_settings
Line 325: integrate_save_cookie_settings
Line 413: integrate_general_security_settings
Line 424: integrate_save_general_security_settings
Line 489: integrate_modify_cache_settings
Line 497: integrate_save_cache_settings
Line 595: integrate_loadavg_settings
Line 622: integrate_save_loadavg_settings
Line 972: integrate_prepare_db_settings

ManageSettings.php (23 hits)
Line 98: integrate_modify_features
Line 119: integrate_modify_modifications
Line 211: integrate_modify_basic_settings
Line 225: integrate_save_basic_settings
Line 266: integrate_modify_bbc_settings
Line 296: integrate_save_bbc_settings
Line 334: integrate_layout_settings
Line 344: integrate_save_layout_settings
Line 376: integrate_likes_settings
Line 386: integrate_save_likes_settings
Line 415: integrate_mentions_settings
Line 425: integrate_save_mentions_settings
Line 473: integrate_warning_settings
Line 531: integrate_save_warning_settings
Line 593: integrate_spam_settings
Line 807: integrate_save_spam_settings
Line 894: integrate_signature_settings
Line 1114: integrate_apply_signature_settings
Line 1189: integrate_save_signature_settings
Line 2105: integrate_prune_settings
Line 2143: integrate_prune_settings
Line 2193: integrate_general_mod_settings
Line 2217: integrate_save_general_mod_settings

ManageSmileys.php (3 hits)
Line 103: integrate_manage_smileys
Line 148: integrate_modify_smiley_settings
Line 168: integrate_save_smiley_settings

Memberlist.php (1 hit)
Line 147: integrate_memberlist_buttons

MessageIndex.php (3 hits)
Line 330: integrate_message_index
Line 622: integrate_quick_mod_actions
Line 757: integrate_messageindex_buttons

ModerationCenter.php (2 hits)
Line 278: integrate_mod_centre_blocks
Line 1394: integrate_warning_log_actions

News.php (3 hits)
Line 185:   integrate_xmlfeeds
Line 217: integrate_xml_data
Line 343: integrate_fix_url

PackageGet.php (3 hits)
Line 77: integrate_package_get
Line 625: integrate_package_download
Line 716: integrate_package_upload

Packages.php (3 hits)
Line 88: integrate_manage_packages
Line 1362: integrate_modification_types
Line 1599: integrate_packages_sort_id

PersonalMessage.php (5 hits)
Line 926: integrate_conversation_buttons
Line 1109: integrate_prepare_pm_context
Line 1705: integrate_search_pm_context
Line 2002: integrate_pm_post
Line 2200: integrate_pm_error

Poll.php (3 hits)
Line 218: integrate_poll_vote
Line 888: integrate_poll_add_edit
Line 1002: integrate_poll_remove

Post.php (4 hits)
Line 1012: integrate_post_errors
Line 1255: integrate_post_end
Line 1936: integrate_poll_add_edit
Line 2161: integrate_post2_end

PostModeration.php (1 hit)
Line 45: integrate_post_moderation

Profile.php (6 hits)
Line 428: integrate_pre_profile_areas
Line 610: integrate_verify_password
Line 661: integrate_profile_save
Line 674: integrate_reset_pass
Line 812: integrate_profile_popup
Line 988: integrate_load_custom_profile_fields

Profile-Actions.php (1 hit)
Line 41: integrate_activate

Profile-Modify.php (9 hits)
Line 297: integrate_reset_pass
Line 597: integrate_load_profile_fields
Line 632: integrate_setup_profile_context
Line 1249: integrate_save_custom_profile_fields
Line 1340: integrate_remove_buddy
Line 1376: integrate_add_buddies
Line 1517: integrate_view_buddies
Line 1979: integrate_alert_types
Line 3131: integrate_profile_profileSaveGroups

Profile-View.php (4 hits)
Line 258: integrate_fetch_alerts
Line 791: integrate_profile_showPosts
Line 1426:  integrate_profile_stats
Line 2103: integrate_profile_trackip

QueryString.php (3 hits)
Line 86: integrate_magic_quotes
Line 91: integrate_magic_quotes
Line 133: integrate_magic_quotes

Recent.php (3 hits)
Line 456: integrate_recent_RecentPosts
Line 1424: integrate_recent_buttons
Line 1429:  integrate_unread_list

Register.php (2 hits)
Line 502: integrate_activate
Line 644: integrate_activate

Reminder.php (2 hits)
Line 266: integrate_reset_pass

RemoveTopic.php (2 hits)
Line 561:   integrate_remove_topics
Line 987: integrate_remove_message

ReportedContent.php (1 hit)
Line 70: integrate_reported_' . $context['report_type']

Reports.php (4 hits)
Line 63: integrate_report_types
Line 119: integrate_report_buttons
Line 394: integrate_reports_boardperm
Line 694: integrate_reports_groupperm

Search.php (12 hits)
Line 239: integrate_search
Line 299: integrate_search_weights
Line 598: integrate_search_sort_columns
Line 613: integrate_search_params
Line 622: integrate_search_blacklisted_words
Line 964: integrate_search_errors
Line 1088: integrate_subject_only_search_query
Line 1336: integrate_subject_search_query
Line 1554: integrate_main_search_query
Line 1765: integrate_search_message_list
Line 2095: integrate_quick_mod_actions_search
Line 2134: integrate_search_message_context

Security.php (6 hits)
Line 38: integrate_validateSession
Line 63: integrate_verify_password
Line 433: integrate_post_ban_permissions
Line 446: integrate_warn_permissions
Line 991: integrate_heavy_permissions_session
Line 1157: integrate_spam_protection

Session.php (1 hit)
Line 74: integrate_session_handlers

ShowAttachments.php (2 hits)
Line 31: integrate_pre_download_request
Line 82: integrate_download_request

Stats.php (1 hit)
Line 705:   integrate_forum_stats

Subs.php (16 hits)
Line 362: integrate_change_member_data
Line 964: integrate_pre_parsebbc
Line 1634: integrate_bbc_codes
Line 2466: integrate_post_parsebbc
Line 2664: integrate_redirect
Line 2725: integrate_buffer
Line 2769: integrate_exit
Line 3036: integrate_theme_context
Line 3154: integrate_security_files
Line 3277: integrate_pre_javascript_output
Line 3385: integrate_pre_css_output
Line 3903: integrate_clean_cache
Line 4106: integrate_menu_buttons
Line 4235: integrate_current_action

Subs-Attachments.php (6 hits)
Line 472: integrate_attachment_upload
Line 696: integrate_createAttachment
Line 847: integrate_assign_attachments
Line 890: integrate_pre_parseAttachBBC
Line 972: integrate_post_parseAttachBBC

Subs-Auth.php (4 hits)
Line 245: integrate_validateSession
Line 608: integrate_reset_pass
Line 803: integrate_mod_cache
Line 834: integrate_cookie

Subs-BoardIndex.php (2 hits)
Line 381: integrate_getboardtree
Line 383: integrate_getboardtree

Subs-Boards.php (4 hits)
Line 464: integrate_pre_modify_board
Line 644: integrate_modify_board
Line 845: integrate_create_board
Line 925: integrate_delete_board

Subs-Calendar.php (3 hits)
Line 839: integrate_create_event
Line 918: integrate_modify_event
Line 961: integrate_remove_event

Subs-Categories.php (4 hits)
Line 35: integrate_pre_modify_category
Line 104: integrate_modify_category
Line 160: integrate_create_category
Line 201: integrate_delete_category

Subs-Editor.php (3 hits)
Line 1562: integrate_load_message_icons
Line 1771: integrate_bbc_buttons
Line 2301: integrate_autosuggest

Subs-List.php (1 hit)
Line 33: integrate_' . $listOptions['id']

Subs-Membergroups.php (2 hits)
Line 108: integrate_delete_membergroups
Line 599: integrate_add_members_to_group

Subs-Members.php (6 hits)
Line 412: integrate_delete_members
Line 532: integrate_register_check
Line 683: integrate_register
Line 713: integrate_post_register
Line 832: integrate_register_after
Line 1241:  integrate_reattribute_posts

Subs-Menu.php (1 hit)
Line 68: integrate_' . $menu_context['current_action'] . '_areas

Subs-Post.php (9 hits)
Line 573: integrate_outgoing_email
Line 818: integrate_personal_message
Line 1137: integrate_personal_message_after
Line 1702: integrate_create_post
Line 1730: integrate_after_create_post
Line 1748: integrate_before_create_topic
Line 1791: integrate_create_topic
Line 1820: integrate_modify_topic
Line 2076: integrate_modify_post

Subs-Themes.php (3 hits)
Line 50: integrate_get_single_theme
Line 122: integrate_get_all_themes
Line 401: integrate_theme_install

Themes.php (3 hits)
Line 100: integrate_manage_themes
Line 1559: integrate_wrap_action

ViewQuery.php (1 hit)
Line 50: integrate_egg_nog

Who.php (10 hits)
Line 435: integrate_whos_online
Line 831: integrate_credits

Xml.php (1 hit)
Line 33: integrate_XMLhttpMain_subActions

Likes-Notify.php (1 hit)
Line 60: integrate_find_like_author

This is the only hook in template files:

Post.template.php (1 hit)
Line 519: integrate_upload_template

Re: Comparing Hooks

Reply #1

Nice!
There is a list of hooks in elk 1.0 at http://www.elkarte.net/community/index.php?topic=2192.0
It may be a little outdated though.

Also, for 1.1, there is the additional "events" that can be used to extend and are similar-but-different (and hopefully more powerful) to hooks. You can catch them by searching for
Code: [Select]
->trigger
Bugs creator.
Features destroyer.
Template killer.

 

Re: Comparing Hooks

Reply #2

Remember Elk also has several "generic" hooks which allow you to act on almost every action and subaction ...  a few that I use are:

Code: [Select]
call_integration_hook('integrate_action_' . $hook . '_before', array($this->_function_name));
call_integration_hook('integrate_action_' . $hook . '_after', array($this->_function_name));
call_integration_hook('integrate_sa_' . $this->_name, array(&$subactions));
call_integration_hook('integrate_list_' . $listOptions['id'], array(&$listOptions));

The first two are in the Site Dispatcher, allowing you to act both before and after an action is initiated.  One minor thing to note and something that is being worked on, is the _after hook is not always guaranteed to fire ... for example an action with an exit / die / fatal etc inside of it.  So pretty much anywhere a ?action=xyz is called, these hooks are called.

The third is in the Action.class allowing you integrate before a sub-action is called from a controller.  This allows you to easily add your own subActions to a controller, or simply act / trigger at the start of any subAction.  So wherever you see $action->initialize() in a controller, that hook is being called (~55 times)

The last is called wherever you see a createList(); call, it allows you to add / modify to any list / form that gets displayed, this is super useful as we really implemented createList (~170 times)

Re: Comparing Hooks

Reply #3

I am impressed by the complexity of ElkArte.. :) I feel I can add just about anything using the numerous hooks.

Quite intrigued by "trigger" though..how does that work? Setting a certain parameter to something will launch a function? 

Re: Comparing Hooks

Reply #4

Quote from: Bloc – Quite intrigued by "trigger" though..how does that work? Setting a certain parameter to something will launch a function? 
Some explanation here:
http://www.elkarte.net/community/index.php?topic=831.msg16689#msg16689
It's still not widely used, but it is already used to build several of the "side-features" of few controllers (off the top of my head calendar and info center are integrated with this method).
Bugs creator.
Features destroyer.
Template killer.

Re: Comparing Hooks

Reply #5

I see. So basically, passing objects give you more freedom than just running the hook functions? Theres lot of power there, and I especially like it because it doesn't sound it will hamper themes much - not the way older SMF mods did on SMF custom themes anyway.

Re: Comparing Hooks

Reply #6

I hope it is more powerful.

It's not that different from the hooks regarding the impact on templates, basically zero (apart some hooks that can be abused to output stuff, but it's quite uncommon).
Bugs creator.
Features destroyer.
Template killer.


Re: Comparing Hooks

Reply #8

It's nothing new that hooks can be abused, and it's not related to proposing new ones. ;)
Bugs creator.
Features destroyer.
Template killer.

Re: Comparing Hooks

Reply #9

Am thinking to look deeper into this today.