Please note: This documentation is a work in progress and does not yet cover all filters & action hooks available in Charitable Ambassadors. If you do not see a hook or filter describing what you need to do, please get in touch via our support page and we can help you.
Filtros
charitable_ambassadors_fundraiser_title
Added in version 2.0.0
u003cpu003eChange the automatically generated title for a new fundraiser, when the title is set to be dynamically based on the campaign creator’s name.u003c/pu003e
Return Value
u003cpu003eString. The title of the fundraiser.u003c/pu003e
Arguments
$title (string)u003cpu003eThe title. By default this will be the campaign creator’s full name.u003c/pu003e
$data (array)u003cpu003eThe submitted data.u003c/pu003e
Uso
add_filter( 'charitable_ambassadors_fundraiser_title', function( $title, $data ) {n $first_name = array_key_exists( 'first_name', $data ) ? $data['first_name'] : '';n $last_name = array_key_exists( 'last_name', $data ) ? $data['last_name'] : '';n $full_name = trim( sprintf( '%s %s', $first_name, $last_name ) );nn // Joe Blow's Fundraisern return sprintf( u0022%s's Fundraiseru0022, $full_name );n}, 10, 2 );
charitable_ambassadors_my_campaigns_show_campaign_creation_link
Added in version 2.0.0
u003cpu003eChoose whether you want to show the u0022Create a New Campaignu0022 button at the bottom of the output of the [charitable_my_campaigns] shortcode.u003c/pu003e
Return Value
u003cpu003eBoolean. True if you do want to show it, or false if you would prefer not to. This will return true by default.u003c/pu003e
Arguments
$show (boolean)u003cpu003eWhether to show the button.u003c/pu003e
Uso
// Do not show the button.nadd_filter( 'charitable_ambassadors_my_campaigns_show_campaign_creation_link', '__return_false' );
charitable_ambassadors_my_campaigns_button_text
Added in version 1.0.0
u003cpu003eChange the text of the u0022Create a Campaignu0022 button at the bottom of the [charitable_my_campaigns] shortcode.u003c/pu003e
Return Value
u003cpu003eString. The text to use in the button.u003c/pu003e
Arguments
$text (string)u003cpu003eThe button text.u003c/pu003e
Uso
add_filter( 'charitable_ambassadors_my_campaigns_button_text', function( $text ) {n return 'Start a New Campaign';n} );
charitable_permalink_campaign_submission_success_page
Added in version 1.0.0
u003cpu003eChange the page that users will be redirected to after they submit their campaign for the first time. Note that if you want to redirect to a static page, you can do this without code by configuring the u0022Campaign Submission Success Pageu0022 setting under Charitable u003e Settings u003e Ambassadors.u003c/pu003e
Return Value
u003cpu003eString. A URL to redirect to after first submitting a campaign. Note that the redirect is done through a call to u003ccodeu003ewp_safe_redirect()u003c/codeu003e, so the URL should be to an allowed host (see u003ca href=u0022https://developer.wordpress.org/reference/functions/wp_safe_redirect/u0022u003ehttps://developer.wordpress.org/reference/functions/wp_safe_redirect/u003c/au003e).u003c/pu003e
Arguments
$default (string)u003cpu003eThe URL to redirect to.u003c/pu003e
$args (array)u003cpu003eAn array of arguments. By default, this will only have a u003ccodeu003ecampaign_idu003c/codeu003e property with the ID of the newly submitted campaign.u003c/pu003e
Uso
// Redirect to the newly submitted campaign after submission.nadd_filter( 'charitable_permalink_campaign_submission_success_page', function( $url, $args = array() ) {n if ( ! array_key_exists( 'campaign_id', $args ) ) {n return $url;n }nn return get_permalink( $args['campaign_id'] );n}, 10, 2 );
charitable_campaign_submission_redirect_url
Added in version 1.0.0
u003cpu003eChange the URL that users are redirected to after they submit, update or save u0026amp; preview their campaign.u003c/pu003eu003cpu003eIf you only want to change the page that users are redirected to after they first submit their campaign, use the u003ca href=u0022https://www.wpcharitable.com/documentation/hooks-filters-in-ambassadors/#charitable_permalink_campaign_submission_success_pageu0022u003echaritable_permalink_campaign_submission_success_pageu003c/au003e filter instead.u003c/pu003e
Return Value
u003cpu003eString. The URL that the user will be redirected to.u003c/pu003e
Arguments
$url (string)u003cpu003eThe URL that the user will be redirected to.u003c/pu003e
$data (array)u003cpu003eThe submitted data.u003c/pu003e
$campaign_id (int)u003cpu003eThe campaign ID.u003c/pu003e
$user_id (int)u003cpu003eThe user ID.u003c/pu003e
charitable_ambassadors_fundraiser_form_field_list
Added in version 2.1.0
u003cpu003eAdd or remove fields to the fundraiser form. u003c/pu003eu003cpu003eThe fields list is a list of keys of fields that are included in the main campaign form, which should also be included in the fundraiser form. The following fields are not included in the fundraiser form by default:u003c/pu003eu003cpu003e- u003ccodeu003edescriptionu003c/codeu003eu003cbru003e- u003ccodeu003ecategoriesu003c/codeu003eu003cbru003e- u003ccodeu003etagsu003c/codeu003eu003cbru003e- u003ccodeu003esuggested_donationsu003c/codeu003eu003cbru003e- u003ccodeu003eallow_custom_donationsu003c/codeu003eu003c/pu003e
Return Value
u003cpu003earrayu003c/pu003e
Arguments
$list (array)u003cpu003eThe list of fields to be included.u003c/pu003e
$form (Charitable_Ambassadors_Fundraiser_Form)u003cpu003eThe fundraiser form object.u003c/pu003e
Uso
// Include the 'description' field in the Fundraiser form.nadd_filter( 'charitable_ambassadors_fundraiser_form_field_list', function( $fields ) {n $fields[] = 'description';n return $fields;n} );
charitable_ambassadors_fundraiser_inherited_fields
Added in version 2.0.0
u003cpu003eFilter the fields that are automatically inherited from the fundraiser’s parent campaign.u003c/pu003e
Return Value
u003cpu003earrayu003c/pu003e
Arguments
$fields (array)u003cpu003eThe inherited fields.u003c/pu003e
Uso
add_filter(n 'charitable_ambassadors_fundraiser_inherited_fields', n function( $fields ) {n $fields[] = 'my_custom_field';n return $fields;n }n);
charitable_ambassadors_update_fundraiser_end_dates_on_parent_end_date_change
Added in version 2.0.0
u003cpu003eSet whether end dates of fundraisers should be updated automatically when a parent campaign has its end date changed.u003c/pu003e
Return Value
u003cpu003eBoolean. Defaults to true.u003c/pu003e
Arguments
$should_update (boolean)u003cpu003eWhether to update automatically.u003c/pu003e
$campaign (Charitable_Campaign)u003cpu003eThe parent campaign object.u003c/pu003e
charitable_ambassadors_creator_donations_export_columns
Added in version 2.0.0
u003cpu003eFilter the columns that are included in the export.u003c/pu003e
Return Value
u003cpu003eArray. The keys of columns to include.u003c/pu003e
Arguments
$columns (array)u003cpu003eThe columns to include.u003c/pu003e
Uso
add_filter( 'charitable_ambassadors_creator_donations_export_columns', function( $columns ) {n // Only show the first name, last name, amount and donor comment.n $included_columns = array(n 'first_name',n 'last_name',n 'amount',n 'donor_comment',n );ntn foreach ( $columns as $column =u003e $header ) {n if ( ! in_array( $column, $included_columns ) ) {n unset( $columns[ $column ] );n }n }ntn return $columns;n} );


