Hubzilla Documentation

Contents

    Hooks


    Hooks allow plugins/addons to "hook into" the code at many points and alter the behaviour or otherwise perform independent actions when an activity takes place or when certain data structures are accessed. There are many hooks which allow you to tie into the software at most any point and do something slightly different than the default thing. These hooks are passed two variables. The first is the App structure which contains details about the entire state of the page request as we build the resulting page. The second is unique to the specific hook that is called and provides specific detail about what is happening in the software at the time the hook is invoked.

    Generated index of all hooks and the files which call them

    module_mod_aftercontent
        General purpose hook for any module, executed after mod_content(). Replace 'module' with module name, e.g. 'photos_mod_aftercontent'.

    module_mod_content
        General purpose hook for any module, executed before mod_content(). Replace 'module' with module name, e.g. 'photos_mod_content'.

    module_mod_init
        General purpose hook for any module, executed before mod_init(). Replace 'module' with module name, e.g. 'photos_mod_init'.

    module_mod_post
        General purpose hook for any module, executed before mod_post(). Replace 'module' with module name, e.g. 'photos_mod_post'.

    about_hook
        Called from the siteinfo page

    accept_follow
        Called when accepting a connection (friend request)

    account_downgrade
        Called when an account has expired, indicating a potential downgrade to "basic" service class

    account_settings
        Called when generating the account settings form

    account_settings_post
        Called when posting from the account settings form

    activity_filter
        Called when generating the list of filters for the network page

    activity_mapper
        Called when determining the activity type for transmission.

    activity_decode_mapper
        Called when determining the activity type for transmission.

    activity_obj_mapper
        Called when determining the object type for transmission.

    activity_obj_decode_mapper
        Called when determining the object type for transmission.

    activity_order
        Called when generating the list of order options for the network page

    addon_app_installed_filter
        Called when determining whether an addon_app is installed

    activity_received
        Called when an activity (post, comment, like, etc.) has been received from a zot source

    admin_aside
        Called when generating the admin page sidebar widget

    affinity_labels
        Used to generate alternate labels for the affinity slider.

    api_perm_is_allowed
        Called when perm_is_allowed() is executed from an API call.

    app_destroy
        Called when an app is deleted

    app_installed_filter
        Called when determining whether an app is installed

    app_menu
        Called when generating the app_menu dropdown (may be obsolete)

    attach_delete
        Called when attachments are deleted from the attach table

    atom_author
        Called when generating an author or owner element for an Atom ActivityStream feed

    atom_entry
        Called when generating each item entry of an Atom ActivityStreams feed

    atom_feed
        Called when generating an Atom ActivityStreams feed

    atom_feed_end
        Called when generation of an Atom ActivityStreams feed is completed

    attach_upload_file
        Called when uploading a file

    authenticate
        Can provide alternate authentication mechanisms

    author_is_pmable
        Called from the thread action menu to determine if we can send private mail to the post author

    bb2diaspora
        called when converting bbcode to markdown

    bbcode
        Called at end of converting bbcode to HTML

    bbcode_filter
        Called when beginning to convert bbcode to HTML

    bb_translate_video
        Called when extracting embedded services from bbcode video elements (rarely used)

    build_pagehead
        Called when creating the HTML page header

    can_comment_on_post
        Called when deciding whether or not to present a comment box for a post

    change_channel
        Called when logging in to a channel (either during login or afterward through the channel manager)

    channel_remove
        Called when removing a channel

    channel_links
        Called when generating the Link: HTTP header for a channel

    channel_settings
        Called when displaying the channel settings page

    chat_message
        Called to create a chat message.

    chat_post
        Called when a chat message has been posted

    check_account_email
        Validate the email provided in an account registration

    check_account_invite
        Validate an invitation code when using site invitations

    check_account_password
        Used to provide policy control over account passwords (minimum length, character set inclusion, etc.)

    check_channelallowed
        Used to over-ride or bypass the channel black/white block lists

    check_siteallowed
        Used to over-ride or bypass the site black/white block lists

    collect_public_recipients
        Used to establish a list of recipients to send a public message to.

    comment_buttons
        Called when rendering the edit buttons for comments

    comments_are_now_closed
        Called when deciding whether or not to present a comment box for a post

    connect_premium
        Called when connecting to a premium channel

    connection_remove
        Called when deleting/removing a connection

    connector_settings
        Called when posting to the features/addon settings page

    construct_page
        General purpose hook to provide content to certain page regions. Called when constructing the Comanche page.

    contact_block_end
        Called when generating the sidebar "Connections" widget

    contact_edit
        Called when editing a connection via connedit

    contact_edit_post
        Called when posting to connedit

    contact_select_options
        Deprecated/unused

    content_security_policy
        Called prior to output of the Content-Security-Policy header

    conversation_start
        Called in the beginning of rendering a conversation (message or message collection or stream)

    cover_photo_content_end
        Called after a cover photo has been uplaoded

    create_identity
        Called when creating a channel

    cron
        Called when scheduled tasks (poller) is executed

    cron_daily
        Called when daily scheduled tasks are executed

    cron_weekly
        Called when weekly scheduled tasks are executed

    crypto_methods
        Called when generating a list of crypto algorithms in the locally preferred order

    daemon_addon
        Called when invoking the extensible background daemon

    daemon_master_release
        Called at the start of processing \Zotlabs\Daemon\Master::Release()

    directory_item
        Called when generating a directory listing for display

    discover_channel_webfinger
        Called when performing a webfinger lookup

    display_item
        Called for each item being displayed in a conversation thread

    display_settings
        Called from settings module when displaying the 'display settings' section

    display_settings_post
        Called when posting from the settings module 'display settings' form

    donate_contributors
        called by the 'donate' addon when generating a list of donation recipients

    donate_plugin
        called by the 'donate' addon

    donate_sponsors
        called by the 'donate' addon

    dreport_is_storable
        called before storing a dreport record to determine whether to store it

    dreport_process
        called for each valid delivery report

    dropdown_extras
        Add additional items to the dropdown cog when item/threads are displayed.

    drop_item
        called when an 'item' is removed

    encode_object
        called when encoding an object for transmission.

    enotify
        called before any notification

    enotify_mail
        called when sending a notification email

    enotify_store
        called when storing a notification record

    enotify_store_end
        called after a notification record has been stored

    event_created
        called when an event record is created

    event_store_event
        called when an event record is created or updated

    event_updated
        called when an event record is modified

    externals_url_select
        called when generating a list of random sites to pull public posts from

    feature_enabled
        called when 'feature_enabled()' is used

    feature_settings
        called from settings page when visiting 'addon/feature settings'

    feature_settings_post
        called from settings page when posting from 'addon/feature settings'

    fetch_and_store
        called to allow filtering of 'decoded' items before storage.

    file_thumbnail
        called when generating thumbnail images for cloud page in 'view tiles' mode

    follow
        called when a follow operation takes place

    follow_from_feed
        called when a follow operation takes place on an RSS feed

    follow_allow
        called before storing the results of a follow operation

    gender_selector
        called when creating the 'gender' drop down list (advanced profile)

    gender_selector_min
        called when creating the 'gender' drop down list (normal profile)

    generate_map
        called to generate the HTML for displaying a map location by coordinates

    generate_named_map
        called to generate the HTML for displaying a map location by text location

    get_all_api_perms
        Called when retrieving the permissions for API uses

    get_all_perms
        called when get_all_perms() is used

    get_best_language
        called when choosing the preferred language for the page

    get_default_export_sections
        Called to get the default list of functional data groups to export in identity_basic_export()

    get_features
        Called when get_features() is called

    get_photo
        Called when photo content (except for profile photos) is fetched in mod_photo

    get_profile_photo
        Called when local profile photo content is fetched in mod_photo

    get_role_perms
        Called when get_role_perms() is called to obtain permissions for named permission roles

    global_permissions
        Called when the global permissions list is generated

    home_content
        Called from mod_home to replace the content of the home page

    home_init
        Called from the home page home_init() function

    hostxrd
        Called when generating .well-known/hosts-meta for "old webfinger" (used by Diaspora protocol)

    html2bb_video
        Called when using the html2bbcode translation to handle embedded media

    html2bbcode
        Called when using the html2bbcode translation

    identity_basic_export
        Called when exporting a channel's basic information for backup or transfer

    import_author_xchan
        Called when looking up an author of a post by xchan_hash to ensure they have an xchan record on our site

    import_channel
        Called when importing a channel from a file or API source

    import_directory_profile
        Called when processing delivery of a profile structure from an external source (usually for directory storage)

    import_xchan
        Called when processing the result of zot_finger() to store the result

    item_photo_menu
        Called when generating the list of actions associated with a displayed conversation item

    item_store
        Called when item_store() stores a record of type item

    item_stored
        Called after item_store() has stored a record of type item in the database.

    item_custom
        Called before item_store() stores a record of type item (allowing addons to process ITEM_TYPE_CUSTOM items).

    item_store_update
        Called when item_store_update() is called to update a stored item.

    item_stored_update
        Called after item_store_update() has updated a stored item.

    item_translate
        Called from item_store and item_store_update after the post language has been autodetected

    jot_networks
        Called to generate the list of additional post plugins to enable from the ACL form

    jot_tool
        Deprecated and possibly obsolete. Allows one to add action buttons to the post editor.

    jot_tpl_filter
        Called to filter template vars before replacement in jot.tpl.

    jot_header_tpl_filter
        Called to filter template vars before replacement in jot_header.tpl.

    legal_webbie
        Called to validate a channel address

    legal_webbie_text
        Provides an explanation of text/character restrictions for legal_webbie()

    load_pdl
        Called when we load a PDL file or description

    local_dir_update
        Called when processing a directory update from a channel on the directory server

    location_move
        Called when a new location has been provided to a UNO channel (indicating a move rather than a clone)

    logged_in
        Called when authentication by any means has succeeeded

    logger
        Called when making an entry to the application logfile

    logging_out
        Called when logging out

    login_hook
        Called when generating the login form

    magic_auth
        Called when processing a magic-auth sequence

    markdown_to_bb
        Called when processing markdown conversion

    match_webfinger_location
        Called when processing webfinger requests

    magic_auth_openid_success
        Called when a magic-auth was successful due to openid credentials

    magic_auth_success
        Called when a magic-auth was successful

    main_slider
        Called when generating the affinity tool

    marital_selector
        Called when generating the list of choices for the 'marital status' profile dropdown (advanced profile)

    marital_selector_min
        Called when generating the list of choices for the 'marital status' profile dropdown (normal profile)

    module_loaded
        Called when a module has been successfully locate to server a URL request

    mood_verbs
        Called when generating the list of moods

    nav
        Called when generating the navigation bar

    network_content_init
        Called when loading cntent for the network page

    network_ping
        Called during a ping request

    network_to_name
        Deprecated

    notifier_end
        Called when a delivery loop has completed

    notifier_hub
        Called when a hub is delivered

    notifier_normal
        Called when the notifier is invoked for a 'normal' delivery

    notifier_process
        Called when the notifier is processing a message/event

    obj_verbs
        Called when creating the list of verbs available for profile "things".

    oembed_action
        Called when deciding if an oembed url is to be filter, blocked, or approved

    oembed_probe
        Called when performing an oembed content lookup

    other_encapsulate
        Called when encrypting content for which the algorithm is unknown (see also crypto_methods)

    other_unencapsulate
        Called when decrypting content for which the algorithm is unknown (see also crypto_methods)

    page_content_top
        Called when we generate a webpage (before calling the module content function)

    page_end
        Called after we have generated the page content

    page_header
        Called when generating the navigation bar

    page_meta
        Called when generating the meta data in the page header.

    parse_atom
        Called when parsing an atom/RSS feed item

    parse_link
        Called when probing a URL to generate post content from it

    pdl_selector
        Called when creating a layout selection in a form

    perm_is_allowed
        Called during perm_is_allowed() to determine if a permission is allowed for this channel and observer

    permissions_create
        Called when an abook entry (connection) is created

    permissions_update
        Called when a permissions refresh is transmitted

    permit_hook
        Called before a registered hook is actually executed to determine if it should be allowed or blocked

    personal_xrd
        Called when generating the personal XRD for "old webfinger" (Diaspora)

    photo_post_end
        Called after uploading a photo

    photo_upload_begin
        Called when attempting to upload a photo

    photo_upload_end
        Called when a photo upload has been processed

    photo_upload_file
        Called to generate alternate filenames for an upload

    photo_upload_form
        Called when generating a photo upload form

    photo_view_filter
        Called before the data is handed over to the photo_view template

    poke_verbs
        Called when generating the list of actions for "poke" module

    post_local
        Called when an item has been posted on this machine via mod/item.php (also via API)

    post_local_end
        Called after a local post operation has completed

    post_local_start
        Called when a local post operation is commencing

    post_mail
        Called when a mail message has been composed

    post_mail_end
        Called when a mail message has been delivered

    post_remote
        Called when an activity arrives from another site

    post_remote_end
        Called after processing a remote post

    post_remote_update
        Called when processing a remote post that involved an edit or update

    post_remote_update_end
        Called after processing a remote post that involved an edit or update

    prepare_body
        Called when generating the HTML for a displayed conversation item

    prepare_body_final
        Called after generating the HTML for a displayed conversation item

    prepare_body_init
        Called before generating the HTML for a displayed conversation item

    privacygroup_extras
        Called before generating the HTML for the Privacy Group edit options

    privacygroup_extras_delete
        Called after privacy group is dropped.

    privacygroup_extras_post
        Called when privacy group edit form is submitted.

    proc_run
        Called when invoking PHP sub processes

    process_channel_sync_delivery
        Called when accepting delivery of a 'sync packet' containing structure and table updates from a channel clone

    profile_advanced
        Called when generating an advanced profile page

    profile_edit
        Called when editing a profile

    profile_photo_content_end
        Called when changing a profile photo

    profile_post
        Called when posting an edited profile

    profile_sidebar
        Called when generating the 'channel sidebar' or mini-profile

    profile_sidebar_enter
        Called before generating the 'channel sidebar' or mini-profile

    queue_deliver
        Called when delivering a queued message

    register_account
        Called when an account has been created

    render_location
        Called to generate an ineractive inline map

    replace_macros
        Called before invoking the template processor

    reverse_magic_auth
        Called before invoking reverse magic auth to send you to your own site to authenticate on this site

    settings_account
        Called when generating the account settings form

    settings_form
        Called when generating the channel settings form

    settings_post
        Called when posting from the channel settings form

    sexpref_selector
        Called when generating a dropdown of sexual preference (advanced profile)

    sexpref_selector_min
        Called when generating a dropdown of sexual preference (normal profile)

    smilie
        Called when translating emoticons

    status_editor
        Called when generating the status_editor.

    stream_item
        Called for each item which is rendered for viewing via conversation()

    system_app_installed_filter
        Called when determining whether a system app is installed

    tagged
        Called when a delivery is processed which results in you being tagged

    thumbnail
        Called when generating thumbnails for cloud storage 'tile' view

    update_unseen
        Called prior to automatically marking items seen which were loaded in the browser

    validate_channelname
        Used to validate the names used by a channel

    webfinger
        Called when visiting the webfinger (RFC7033) service

    well_known
        Called when accessing the '.well-known' special site addresses

    wiki_preprocess
        Called before markdown/bbcode processors are run for wiki pages

    zot_best_algorithm
        Called when negotiating crypto algorithms with remote sites

    zid
        Called when adding the observer's zid to a URL

    zid_init
        Called when authenticating a visitor who has used zid

    zot_finger
        Called when a zot-info packet has been requested (this is our webfinger discovery mechanism)