/** * @link https://library.wpcode.com/snippet/rov9rl2l/ */ add_filter( ‘simpay_get_localized_error_list’, /** * @param array $messages Stripe error messages. Keyed by error code. * @return array */ function( $messages ) { // https://stripe.com/docs/error-codes#coupon-expired $messages[‘coupon_expired’] = ‘The coupon has expired and is no longer valid’;…Continue reading
/** * @link https://library.wpcode.com/snippet/e5wng05d/ * * @param \Stripe\Event $event Stripe Event. * @param \Stripe\Subscription|\Stripe\PaymentIntent $object Stripe Subscription or PaymentIntent */ function simpay_add_metadata_to_customer( $event, $object ) { $customer_id = $object->customer->id; $customer = \SimplePay\Core\Payments\Stripe_API::request( ‘Customer’, ‘update’, $customer_id, array( ‘metadata’ => $object->metadata->toArray(), )…Continue reading
/** * @link https://library.wpcode.com/editor/ro8wd9ow/ */ add_filter( ‘simpay_get_paymentintent_args_from_payment_form_request’, /** * @param array $args Payment Intent arguments. * @param \SimplePay\Core\Abstracts\Form $form Form instance. */ function( $args, $form ) { $args[‘description’] = $form->item_description; return $args; }, 10, 2 );Continue reading
/** * @link https://library.wpcode.com/snippet/d2zk7n2x/ */ add_filter( ‘simpay_get_customer_args_from_payment_form_request’, /** * @param array $args * @return array */ function( $args ) { if ( isset( $args[‘phone’] ) ) { $args[‘metadata’][‘phone’] = $args[‘phone’]; } return $args; } );Continue reading
/** * @link https://library.wpcode.com/snippet/3234y0or/ */ add_filter( ‘simpay_get_customer_args_from_payment_form_request’, /** * @param array $customer_args * @param SimplePay\Core\Abstracts\Form $form Form instance. * @param array $form_data Form data generated by the client. * @param array $form_values Values of named fields in the payment form.…Continue reading
// Remove side menu add_action( ‘admin_menu’, function () { remove_menu_page( ‘edit.php’ ); } ); // Remove +New post in top Admin Menu Bar add_action( ‘admin_bar_menu’, function ( $wp_admin_bar ) { $wp_admin_bar->remove_node( ‘new-post’ ); }, 999 ); // Remove Quick Draft…Continue reading
/** * Make standard form fields to make read-only * To apply, add CSS class ‘wpf-disable-field’ (no quotes) to field in form builder * * @link https://wpforms.com/developers/disable-a-form-field-to-prevent-user-input/ * * For support, please visit: https://www.facebook.com/groups/wpformsvip */ function wpf_dev_disable_field() { ?>Continue reading
/** * Block form submissions based on IP address * * @link https://wpforms.com/developers/how-to-block-ip-addresses-from-completing-your-form/ * * For support, please visit: https://www.facebook.com/groups/wpformsvip */ function wpf_ip_block( $fields, $entry, $form_data ) { // Get the current users IP address $ip_address = wpforms_get_ip(); // Enter…Continue reading