Custom Registration Fields

/** * Add fields to the registration form. * * @param array $fields * @return array */ add_filter( ‘charitable_user_registration_fields’, function( $fields ) { /* Add a text field. */ $fields[‘text_field’] = [ ‘type’ => ‘text’, ‘label’ => ‘My Text Field’,…Continue reading

Set New User Role

/** * Set the role of users who register through the Charitable * registration form shortcode. * * @param array $values * @return array $values */ function ed_charitable_set_user_registration_role( $values ) { if ( array_key_exists( ‘role’, $values ) ) { return…Continue reading

Set Custom Redirection After Registration

/** * Send the user to a custom page after they have registered. * * @param array[] $fields * @return array[] $fields */ function en_set_custom_redirection_after_registration( $fields ) { if ( ! isset( $_GET[ ‘redirect_to’ ] ) ) { $fields[ ‘redirect_to’…Continue reading

Send New User Notifications

/** * Send the new user notification after someone registers * through the Charitable registration form. */ add_action( ‘charitable_after_insert_user’, ‘wp_send_new_user_notifications’ );Continue reading

Customize Donation Stats

/** * Customize the stats that are shown in the Donation Stats widget. * * In this example, we only show the stats specific to a particular category. * * @param array $donation_stats The default stats to show. * @return…Continue reading

Send Notifications On User Registration

/** * Notify admin and user when a user registers with Charitable. * * @param array[] $fields * @param Charitable_Donation_Form $form * @return array[] */ function charitable_notify_new_user($user_id, $values) { wp_new_user_notification( $user_id, null, ‘admin’ ); } add_action(‘charitable_after_insert_user’, ‘charitable_notify_new_user’, 10, 2);Continue reading

Add Country

/** * Add Kosovo to the list of countries in Charitable. */ add_filter( ‘charitable_countries’, function( $countries ) { $countries[‘XK’] = ‘Kosovo’; return $countries; } );Continue reading

Change Currency Format By Locale

/** * By default, Charitable allows you to specify a single currency format * for the whole site. However, if you are running a multi-lingual * fundraising website, you may want to use a different format for each * language.…Continue reading

Add Currency

/** * Add a new currency. * * @param string[] $currencies The list of registered currencies. * @return string[] */ function ed_charitable_add_currency( $currencies ) { /** * We’re adding the Armenian Dram currency (AMD). * * Note that the three-letter…Continue reading

Add Hours Currency

/** * Add a custom currency called “Hours”. * * @param string[] $currencies * @return string[] $currencies */ function en_add_hours_currency( $currencies ) { $currencies[ ‘HOURS’ ] = __( ‘Hours’, ‘your-namespace’ ); return $currencies; } add_filter( ‘charitable_currencies’, ‘en_add_hours_currency’ );Continue reading