bp_dtheme_register_actions()

Register AJAX handlers for BP Default theme functionality.


Description Description

This function is registered to the after_setup_theme hook with priority 20 as this file is included in a function hooked to after_setup_theme at priority 10.


Source Source

File: bp-themes/bp-default/_inc/ajax.php

function bp_dtheme_register_actions() {
	$actions = array(
		// Directory filters
		'blogs_filter'    => 'bp_dtheme_object_template_loader',
		'forums_filter'   => 'bp_dtheme_object_template_loader',
		'groups_filter'   => 'bp_dtheme_object_template_loader',
		'members_filter'  => 'bp_dtheme_object_template_loader',
		'messages_filter' => 'bp_dtheme_messages_template_loader',

		// Friends
		'accept_friendship' => 'bp_dtheme_ajax_accept_friendship',
		'addremove_friend'  => 'bp_dtheme_ajax_addremove_friend',
		'reject_friendship' => 'bp_dtheme_ajax_reject_friendship',

		// Activity
		'activity_get_older_updates'  => 'bp_dtheme_activity_template_loader',
		'activity_mark_fav'           => 'bp_dtheme_mark_activity_favorite',
		'activity_mark_unfav'         => 'bp_dtheme_unmark_activity_favorite',
		'activity_widget_filter'      => 'bp_dtheme_activity_template_loader',
		'delete_activity'             => 'bp_dtheme_delete_activity',
		'delete_activity_comment'     => 'bp_dtheme_delete_activity_comment',
		'get_single_activity_content' => 'bp_dtheme_get_single_activity_content',
		'new_activity_comment'        => 'bp_dtheme_new_activity_comment',
		'post_update'                 => 'bp_dtheme_post_update',
		'bp_spam_activity'            => 'bp_dtheme_spam_activity',
		'bp_spam_activity_comment'    => 'bp_dtheme_spam_activity',

		// Groups
		'groups_invite_user' => 'bp_dtheme_ajax_invite_user',
		'joinleave_group'    => 'bp_dtheme_ajax_joinleave_group',

		// Messages
		'messages_autocomplete_results' => 'bp_dtheme_ajax_messages_autocomplete_results',
		'messages_close_notice'         => 'bp_dtheme_ajax_close_notice',
		'messages_delete'               => 'bp_dtheme_ajax_messages_delete',
		'messages_markread'             => 'bp_dtheme_ajax_message_markread',
		'messages_markunread'           => 'bp_dtheme_ajax_message_markunread',
		'messages_send_reply'           => 'bp_dtheme_ajax_messages_send_reply',
	);

	/**
	 * Register all of these AJAX handlers
	 *
	 * The "wp_ajax_" action is used for logged in users, and "wp_ajax_nopriv_"
	 * executes for users that aren't logged in. This is for backpat with BP <1.6.
	 */
	foreach( $actions as $name => $function ) {
		add_action( 'wp_ajax_'        . $name, $function );
		add_action( 'wp_ajax_nopriv_' . $name, $function );
	}
}

Top ↑

Changelog Changelog

Changelog
Version Description
BuddyPress (1.6) Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.