Actions/Filters for Developers

Estimated reading: 7 minutes 2138 views

Organization Toolkit provides the following Actions and Filters that allow Developers to hook into its functionality. These can be used to create custom integrations or help with automation with your wider system.

Filter: org_toolkit_imported_users_pre_import

Description: Allows you to manipulate an array of imported users from a CSV import.


					apply_filters( 'org_toolkit_imported_users_pre_import', $imported_users );
				

Action: org_toolkit_new_imported_user

Description: Fires when each new user is added via CSV import, allowing you to carry out custom functionality afterwards.


					do_action('org_toolkit_new_imported_user',$user_id,$user_data,$custom_fields);
				

Action: org_toolkit_registration_form_registrant

Description: Fires after a registration form has successfully identified or created a WordPress user. It can be used to trigger integrations, logging or other custom functionality for both new and existing users.

Updated in Organization Toolkit version 1.5.3 to include the WordPress user object and the data used to create a new account.

do_action(
    'org_toolkit_registration_form_registrant',
    $user_id,
    $account_type,
    $access_code_details,
    $user,
    $userdata
);

Parameters:

  • $user_id – The ID of the registered WordPress user.
  • $account_type – Indicates whether this was a new or existing account.
  • $access_code_details – Details of the verified access code and its associated group, organization and redirect settings.
  • $user – The registered user as a WP_User object.
  • $userdata – The data used to create a new account. This will be an empty array when an existing account is used.

Example:

add_action(
    'org_toolkit_registration_form_registrant',
    'my_registration_integration',
    10,
    5
);

function my_registration_integration(
    $user_id,
    $account_type,
    $access_code_details,
    $user,
    $userdata
) {
    // Add your custom integration here.
}

Filter: org_toolkit_simple_post_type_lookup_args

Description: Allows developers to modify the query used by Organization Toolkit to retrieve groups, organizations and other post types for administrative lists and dropdown fields. It can be used to change ordering or add additional query conditions.

Available in Organization Toolkit version 1.5.3.

$group_query_args = apply_filters(
    'org_toolkit_simple_post_type_lookup_args',
    $group_query_args,
    $type,
    $orderby
);

Parameters:

  • $group_query_args – The arguments that will be passed to WordPress’s get_posts() function.
  • $type – The post type being retrieved, such as b2borganisation or groups.
  • $orderby – The original ordering value requested by Organization Toolkit.

Example:

add_filter(
    'org_toolkit_simple_post_type_lookup_args',
    'my_org_toolkit_lookup_order',
    10,
    3
);

function my_org_toolkit_lookup_order(
    $query_args,
    $post_type,
    $original_orderby
) {
    if ( in_array( $post_type, array( 'b2borganisation', 'groups' ), true ) ) {
        $query_args['orderby'] = 'title';
        $query_args['order']   = 'ASC';
    }

    return $query_args;
}

Action: org_toolkit_access_code_used

Description: Fires whenever an access code is used and contains information on whether or not it was valid


					do_action('org_toolkit_access_code_used',$reg_form_id, $entered_code, $code_status, $access_code_details);
				

Filter: org_toolkit_regform_profile_fields_public

Description: Allows you to customise the user profile fields that the Organization Toolkit allows you to capture in the frontend of your platform.

Available in Organization Toolkit version 1.4.


					apply_filters('org_toolkit_regform_profile_fields_public',$fields);
				

Filter: org_toolkit_regform_profile_fields_admin

Description: Allows you to customise the user profile fields that the Organization Toolkit allows you to capture in the backend of your platform.

Available in Organization Toolkit version 1.4.


					apply_filters('org_toolkit_regform_profile_fields_admin',$fields);
				

Action: org_toolkit_registration_custom_actions

Description: Allows you to hook into the registration form process and carry out additional actions based on a number of available parameters.

Available in Organization Toolkit version 1.4.


					do_action('org_toolkit_registration_custom_actions',$user_id,$reg_form,$verified_code,$postdata);
				

Action: org_toolkit_reg_form_before_user_fields

Description: Allows you to add custom content to the registration forms above the user fields.

Available in Organization Toolkit version 1.4.


					do_action('org_toolkit_reg_form_before_user_fields',$post->ID,$post);
				

Action: org_toolkit_reg_form_after_user_fields

Description: Allows you to add custom content to the registration forms below the user fields.

Available in Organization Toolkit version 1.4.


					do_action('org_toolkit_reg_form_after_user_fields',$post->ID,$post);				

Action: org_toolkit_reg_form_end_of_form

Description: Allows you to add custom content at the end of the registration form.

Available in Organization Toolkit version 1.4.


					do_action('org_toolkit_reg_form_end_of_form',$post->ID,$post)				

Filter: org_toolkit_allow_logged_in_registrants

Description: Allows you to disable access to registration forms for users who are already logged in. Instead of seeing the form they will be shown a button with an option to log out.

Available in Organization Toolkit version 1.4.


					apply_filters('org_toolkit_allow_logged_in_registrants',true);				

Action: org_toolkit_organization_fields_after

Description: Allows you to insert additional content or fields after the Organization settings in the WordPress Dashboard.

Available in Organization Toolkit version 1.4.3


					            do_action('org_toolkit_organization_fields_after', $post);				

Action: org_toolkit_organization_save_fields

Description: Allows you to hook into the Organization save action to capture additional posted information (such as custom fields).

Available in Organization Toolkit version 1.4.3


					        do_action('org_toolkit_organization_save_fields', $post_id, $post, $_POST);				

Filter: org_toolkit_permitted_user_fields_admin

Description: Allows you to amend the permitted fields that can be captured during registration via a registration form.

Available in Organization Toolkit version 1.4.3


					apply_filters('org_toolkit_permitted_user_fields_admin',$permitted_fields);				

Filter: org_toolkit_import_example_user

Description: Allows you to amend the structure of the example user import CSV.

Available in Organization Toolkit version 1.4.3


					apply_filters('org_toolkit_import_example_user',$example_user);				

Action: org_toolkit_user_import_completed

Description: Fires each time a user is imported via a CSV import, allowing you to add custom actions.

Available in Organization Toolkit version 1.4.3


					        do_action('org_toolkit_user_import_completed', $user);				

Action: org_toolkit_before_import_user_instructions

Description: Allows custom text to be added before the user import from CSV instructions.

Available in Organization Toolkit version 1.4.3


					do_action('org_toolkit_before_import_user_instructions');				

Filter: org_toolkit_show_import_user_instructions

Description: Allows you to hide the user import instructions completely.

Available in Organization Toolkit version 1.4.3


					apply_filters('org_toolkit_show_import_user_instructions',true)				

Action: org_toolkit_after_import_user_instructions

Description: Allows you to include custom information after the csv import instructions.

Available in Organization Toolkit version 1.4.3


					do_action('org_toolkit_after_import_user_instructions'); 				

Filter: b2bdash_custom_logo_override

Description: Allows you to override the logo used for a user

Available in Organization Toolkit version 1.4.3


					apply_filters( 'b2bdash_custom_logo_override', null );				

Filter: org_toolkit_import_require_email

Description: Allows you to specify if an email address is required for users imported via a CSV.

Available in Organization Toolkit version 1.4.3


					apply_filters('org_toolkit_import_require_email',true);				

Filter: org_toolkit_filter_dashboard_groups

Description: Allows you to filter the group data that gets passed into the client dashboard.

Available in Organization Toolkit version 1.4.5


					apply_filters('org_toolkit_filter_dashboard_groups',$groupdata,$user_id,$organisation_id);				

Filter: org_toolkit_client_dashboard_user_course_progress

Description: Allows you to filter the course progress information of a user shown in the client dashboard.

Available in Organization Toolkit version 1.4.5


					apply_filters('org_toolkit_client_dashboard_user_course_progress',$progress,$user_id,$group_id);				

Action: org_toolkit_client_dashboard_before_learners

Description: Allows you to include custom information at the top of the admin dashboard, before the learners are listed.

Available in Organization Toolkit version 1.4.5


					do_action('org_toolkit_client_dashboard_before_learners', $group_id);				

Action: org_toolkit_client_dashboard_learner_course_after

Description: Allows you to include custom information underneath each of a learner’s courses in the client dashboard.

Available in Organization Toolkit version 1.4.5


					do_action('org_toolkit_client_dashboard_learner_course_after', $learner, $group_id, $course );				

Action: org_toolkit_client_dashboard_learner_after

Description: Allows you to include custom information underneath each learner the client dashboard.

Available in Organization Toolkit version 1.4.5


					do_action('org_toolkit_client_dashboard_learner_after', $learner, $group_id );				

Leave a Comment

Share this Doc

Actions/Filters for Developers

Or copy link

CONTENTS