# Available Hooks in Asgaros Forum Overview of [actions](#actions) and [filters](#filters) at asgaros forum. ## Actions - asgarosforum_after_post_author - asgarosforum_after_post_message - asgarosforum_after_add_topic_submit - asgarosforum_after_add_post_submit - asgarosforum_after_edit_post_submit - asgarosforum_after_topic_approve - [asgarosforum_{current_view}_custom_content_top](#asgarosforum_current_view_custom_content_top) - asgarosforum_{current_view}_custom_content_bottom - asgarosforum_editor_custom_content_bottom - asgarosforum_statistics_custom_element - asgarosforum_statistics_custom_content_bottom - asgarosforum_admin_show_custom_category_data - asgarosforum_before_delete_post - asgarosforum_before_delete_topic - asgarosforum_after_delete_post - asgarosforum_after_delete_topic - asgarosforum_custom_forum_column - asgarosforum_custom_topic_column - asgarosforum_custom_profile_content - asgarosforum_custom_profile_menu - asgarosforum_custom_header_menu - asgarosforum_prepare_{current_view} - asgarosforum_wp_head - asgarosforum_bottom_navigation - asgarosforum_usergroup_{ID}_add_user - asgarosforum_usergroup_{ID}_remove_user - asgarosforum_prepare - asgarosforum_breadcrumbs_{current_view} - [asgarosforum_content_top](#asgarosforum_content_top) - [asgarosforum_content_header](#asgarosforum_content_header) - asgarosforum_after_category - asgarosforum_after_forum - asgarosforum_after_topic - asgarosforum_after_post - asgarosforum_content_bottom - asgarosforum_add_admin_submenu_page - asgarosforum_execution_check - asgarosforum_enqueue_css_js - asgarosforum_profile_row - asgarosforum_after_add_reaction - asgarosforum_after_remove_reaction - asgarosforum_after_update_reaction ### asgarosforum_after_post_author ### asgarosforum_after_post_message ### asgarosforum_after_add_topic_submit ### asgarosforum_after_add_post_submit ### asgarosforum_after_edit_post_submit ### asgarosforum_after_topic_approve ### asgarosforum_{current_view}_custom_content_top #### Description Make some action on top of asgaros forum for a specific view. The code will be executed before the header. Available Views: | view_name | Description | |--------------|-----------------------------------------| | overview | Overview page of all forums | | forum | Page with a single forum | | topic | Page with a single topic | | post | Only used in the single post shortcode | | editpost | Edit a post | | addpost | Add a post | | addtopic | Add a topic | | movetopic | Move a topic | | search | Page with results of search | | subscription | Overview of all subscriptions of a user | | profile | Page with profile of Asgaros Forum | | history | Page with users history in profile | | members | Page with list of members | | activity | Activity page of Forum | | unread | Page with unread posts | | unapproved | Page with unapproved posts/topics | | reports | page with reported posts/topics | #### Usage ```php ``` #### Examples ```php Welcome to the List of all Members'; } ?> ``` #### Source [forum.php](includes/forum.php) ### asgarosforum_{current_view}_custom_content_bottom ### asgarosforum_editor_custom_content_bottom ### asgarosforum_statistics_custom_element ### asgarosforum_statistics_custom_content_bottom ### asgarosforum_admin_show_custom_category_data ### asgarosforum_before_delete_post ### asgarosforum_before_delete_topic ### asgarosforum_after_delete_post ### asgarosforum_after_delete_topic ### asgarosforum_custom_forum_column ### asgarosforum_custom_topic_column ### asgarosforum_custom_profile_content ### asgarosforum_custom_profile_menu ### asgarosforum_custom_header_menu ### asgarosforum_prepare_{current_view} ### asgarosforum_wp_head ### asgarosforum_bottom_navigation ### asgarosforum_usergroup_{ID}_add_user ### asgarosforum_usergroup_{ID}_remove_user ### asgarosforum_prepare ### asgarosforum_breadcrumbs_{current_view} ### asgarosforum_content_top #### Description Make some action on top of asgaros forum. The code will be executed before the header. #### Usage ```php ``` #### Examples ```php Welcome to our Forum'; } ?> ``` #### Source [forum.php](includes/forum.php) ### asgarosforum_content_header #### Description Make some action after the content header #### Usage ```php ``` #### Examples ```php Please read the forum rules before creating a topic.'; } ?> ``` #### Source [forum.php](includes/forum.php) ### asgarosforum_after_category ### asgarosforum_after_forum ### asgarosforum_after_topic ### asgarosforum_after_post ### asgarosforum_content_bottom ### asgarosforum_add_admin_submenu_page ### asgarosforum_execution_check ### asgarosforum_enqueue_css_js ### asgarosforum_profile_row ### asgarosforum_after_add_reaction ### asgarosforum_after_remove_reaction ### asgarosforum_after_update_reaction ## Filters - [asgarosforum_filter_username](#asgarosforum_filter_username) - asgarosforum_filter_login_message - [asgarosforum_filter_post_username](#asgarosforum_filter_post_username) - asgarosforum_filter_post_content - asgarosforum_filter_post_shortcodes - asgarosforum_filter_editor_settings - asgarosforum_filter_editor_buttons - asgarosforum_filter_get_posts - asgarosforum_filter_get_threads - asgarosforum_filter_get_posts_order - asgarosforum_filter_get_threads_order - asgarosforum_filter_notify_global_topic_subscribers_message - asgarosforum_filter_notify_topic_subscribers_message - asgarosforum_filter_notify_mentioned_user_message - asgarosforum_filter_insert_custom_validation - asgarosforum_filter_subject_before_insert - asgarosforum_filter_content_before_insert - [asgarosforum_filter_before_post_submit](#asgarosforum_filter_before_post_submit) - [asgarosforum_filter_before_edit_post_submit](#asgarosforum_filter_before_edit_post_submit) - [asgarosforum_filter_before_topic_submit](#asgarosforum_filter_before_topic_submit) - asgarosforum_filter_widget_title_length - asgarosforum_widget_excerpt_length - asgarosforum_subscriber_mails_new_post - asgarosforum_subscriber_mails_new_topic - asgarosforum_filter_error_message_require_login - asgarosforum_filter_user_groups_taxonomy_name - asgarosforum_filter_avatar_size - [asgarosforum_filter_profile_header_image](#asgarosforum_filter_profile_header_image) - asgarosforum_filter_profile_link - asgarosforum_filter_history_link - [asgarosforum_filter_show_header](#asgarosforum_filter_show_header) - [asgarosforum_filter_header_menu](#asgarosforum_filter_header_menu) - asgarosforum_filter_forum_menu - asgarosforum_filter_topic_menu - asgarosforum_filter_post_menu - asgarosforum_filter_members_link - asgarosforum_filter_automatic_topic_title - asgarosforum_filter_automatic_topic_content - asgarosforum_filter_widget_avatar_size - asgarosforum_filter_get_sticky_topics_order - asgarosforum_user_replacements - asgarosforum_seo_trailing_slash - asgarosforum_reactions - asgarosforum_widget_recent_posts_custom_content - asgarosforum_widget_recent_topics_custom_content - asgarosforum_title_separator - [asgarosforum_filter_profile_row](#asgarosforum_filter_profile_row) - asgarosforum_signature - [asgarosforum_filter_meta_post_type](#asgarosforum_filter_meta_post_type) - [asgarosforum_filter_upload_folder](#asgarosforum_filter_upload_folder) ### asgarosforum_filter_username #### Description Change the username to a custom name. #### Parameters ##### $user_name Username that will be shown in forum. ##### $user_object User Object of User. #### Usage ```php ``` #### Examples ```php first_name; // Set default name if user didn't set a first name if (empty($new_username)){ $new_username = $username; } return $new_username; } ?> ``` #### Source [forum.php](includes/forum.php) [forum-profile.php](includes/forum-profile.php) ### asgarosforum_filter_login_message ### asgarosforum_filter_post_username #### Description Change Username in a post. You can also use it to add some further information after the username #### Usage ```php ``` #### Examples ```php roles) . " "; // Add user role to username $username = $username . $user_roles; // Return string to render return $username; } ?> ``` #### Source [post-element.php](includes/post-element.php) ### asgarosforum_filter_post_content ### asgarosforum_filter_post_shortcodes ### asgarosforum_filter_editor_settings ### asgarosforum_filter_editor_buttons ### asgarosforum_filter_get_posts ### asgarosforum_filter_get_threads ### asgarosforum_filter_get_posts_order ### asgarosforum_filter_get_threads_order ### asgarosforum_filter_notify_global_topic_subscribers_message ### asgarosforum_filter_notify_topic_subscribers_message ### asgarosforum_filter_notify_mentioned_user_message ### asgarosforum_filter_insert_custom_validation ### asgarosforum_filter_subject_before_insert ### asgarosforum_filter_content_before_insert ### asgarosforum_filter_before_post_submit #### Description Adjust a post before it is being submitted or cancel the submission. #### Parameters ##### $add_post Array with all information of the post: ```php $add_post = array( 'topic' => $this->asgarosforum->current_topic, // topic id 'forum' => $this->asgarosforum->current_forum, // forum id 'content' => $this->data_content, // content of the post 'author' => $author_id, // author id 'upload_list' => $upload_list, // list of files to upload 'warning' => null, // String to output as warning 'error' => null, // String to output as error 'redirect' => null, // URL to redirect 'add_post' => true, // Boolean if post will be added ); ``` #### Usage ```php ``` #### Examples ```php 1000){ // Set error message $add_post['error'] = "Your post is too long!!"; // Dump the submitted post $add_post['add_post'] = false; } return $add_post; } ?> ``` #### Source [forum-content.php](includes/forum-content.php) ### asgarosforum_filter_before_edit_post_submit #### Description Adjust an edited post before it is being submitted or cancel the submission. #### Parameters ##### $edit_post Array with all information of the post: ```php $edit_post = array( 'subject' => $this->data_content, // subject of the topic 'content' => $this->data_content, // content of the post 'editor' => $this->asgarosforum->permissions->currentUserID,, // editor id 'upload_list' => $upload_list, // list of files to upload 'warning' => null, // String to output as warning 'error' => null, // String to output as error 'redirect' => null, // URL to redirect 'edit_post' => true, // Boolean if post will be added ); ``` #### Usage ```php ``` #### Examples ```php 1000){ // Set error message $edit_post['error'] = "Your post is too long!!"; // Dump the submitted post $edit_post['edit_post'] = false; } return $edit_post; } ?> ``` #### Source [forum-content.php](includes/forum-content.php) ### asgarosforum_filter_before_topic_submit #### Description Adjust a topic before it is being submitted or cancel the submission. #### Parameters ##### $add_topic Array with all information of the topic: ```php $add_topic = array( 'forum' => $this->asgarosforum->current_forum, // forum id 'subject' => $this->data_subject, // subject of topic 'content' => $this->data_content, // content of the topic 'author' => $author_id, // author id 'upload_list' => $upload_list, // list of files to upload 'warning' => null, // String to output as warning 'error' => null, // String to output as error 'redirect' => null, // URL to redirect 'add_topic' => true, // Boolean if topic will be added ); ``` #### Usage ```php ``` #### Examples ```php ``` #### Source [forum-content.php](includes/forum-content.php) ### asgarosforum_filter_widget_title_length ### asgarosforum_widget_excerpt_length ### asgarosforum_subscriber_mails_new_post ### asgarosforum_subscriber_mails_new_topic ### asgarosforum_filter_error_message_require_login ### asgarosforum_filter_user_groups_taxonomy_name ### asgarosforum_filter_avatar_size ### asgarosforum_filter_profile_header_image #### Description Filters the URL to the background image of the forum profile header. #### Parameters ##### $url URL to the background image. ##### $user_id User ID of shown profile. #### Usage ```php ``` #### Examples ```php ``` #### Source [forum-profile.php](includes/forum-profile.php) ### asgarosforum_filter_profile_link ### asgarosforum_filter_history_link ### asgarosforum_filter_show_header #### Description Show or hide the forum header. #### Parameters ##### $show_header Boolean value to show or hide header **true**: show header **false**: hide header #### Usage ```php ``` #### Examples ```php ``` #### Source [forum.php](includes/forum.php) ### asgarosforum_filter_header_menu #### Description Filter the header menu of asgaros forum. #### Parameters ##### $menu_entries Array with Menu Entries as arrays: ```php $menu_entries = array( 'name' => array( 'menu_class' => 'HTML Class' 'menu_link_text' => 'Link Text', 'menu_url' => '/url', 'menu_login_status' => '0', // (0 = all, 1 = only logged in, 2 = only logged out) 'menu_new_tab' => true // (true = open in new tab, false = open in same tab ), ); ``` Names of the standard menu entries: | name | description | visibility | |--------------|-------------------------------------|-----------------| | home | Homepage of the Asgaros Forum | Always | | profile | Profile of the active member | Only logged in | | memberslist | List of all members | Always | | subscription | Page to manage subscriptions | Only logged in | | activity | Page of all activities in the forum | Always | | login | Login page | Only logged out | | register | Register Page | Only logged out | | logout | Logout actual user | Only logged out | #### Usage ```php ``` #### Examples ```php 'impress', 'menu_link_text' => 'Impress', 'menu_url' => '/impress', 'menu_login_status' => '0', 'menu_new_tab' => true ); // Add Entry at beginning of the menu array_unshift( $menu_entries, $menu_entry); return $menu_entries; } ?> ``` #### Source [forum.php](includes/forum.php) ### asgarosforum_filter_forum_menu ### asgarosforum_filter_topic_menu ### asgarosforum_filter_post_menu ### asgarosforum_filter_members_link ### asgarosforum_filter_automatic_topic_title ### asgarosforum_filter_automatic_topic_content ### asgarosforum_filter_widget_avatar_size ### asgarosforum_filter_get_sticky_topics_order ### asgarosforum_user_replacements ### asgarosforum_seo_trailing_slash ### asgarosforum_reactions ### asgarosforum_widget_recent_posts_custom_content ### asgarosforum_widget_recent_topics_custom_content ### asgarosforum_title_separator ### asgarosforum_filter_profile_row #### Description Filters the rows in the Asgaros Forum Profile before they are getting rendered #### Parameters ##### $profile_rows Array with profile rows as arrays: ```php $profile_rows = array( 'name' => array( 'title' => 'Title of profile row' 'value' => 'Value of profile row', 'type' => '', // optional type of profile row. 'usergroup' or '' ), ); ``` Names of the standard rows: | name | Description | |--------------|----------------------| | first_name | First name of user | | usergroup | Group of user | | website | Website of user | | last_seen | Last seen of user | | member_since | User is member since | | bio | Excerpt of users bio | | signature | Users signature | ##### $userData WP_User object of the profile to render #### Usage ```php ``` #### Examples ```php 'Last Name', 'value' => $userData->last_name, ); // Add row at beginning of the user profile array_unshift( $profile_rows, $profile_row); return $profile_rows; } ?> ``` #### Source [forum-profile.php](includes/forum-profile.php) ### asgarosforum_signature ### asgarosforum_filter_meta_post_type #### Description Add the metabox to a custom post type #### Parameters ##### $post_types Array with post types ```php $menu_entries = array('post', 'page'); ``` #### Usage ```php ``` #### Examples ```php ``` #### Source [forum.php](includes/forum.php) ### asgarosforum_filter_upload_folder #### Description Change the folder for image uploads. #### Parameters ##### $upload_folder String with the current name of the upload folder. #### Usage ```php ``` #### Examples ```php ``` #### Source [forum-uploads.php](includes/forum-uploads.php)