Skip to content

Commit

Permalink
wip: Add shortcode redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
kjohnson committed Jul 31, 2023
1 parent a5e9f2e commit 4f1928a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion includes/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function give_donation_history( $atts, $content = false ) {
*
* @since 2.30.0 Add short-circuit filter to allow for custom output.
* @since 1.0
* @param array $atts Shortcode attributes
*
* @return string
Expand All @@ -149,6 +149,8 @@ function give_form_shortcode( $atts ) {
$atts['id'] = $atts['id'] ?: FrontendFormTemplateUtils::getFormId();
$formId = absint( $atts['id'] );

give_redirect_form_id($formId, $atts['id']);

// Short-circuit the shortcode output if the filter returns a non-empty string.
$output = apply_filters('givewp_form_shortcode_output', '', $atts);

Expand Down Expand Up @@ -212,6 +214,8 @@ function give_goal_shortcode( $atts ) {
Give_Notices::print_frontend_notice( __( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true );
}

give_redirect_form_id($atts['id']);

// Sanity check 2: Check the form even has Goals enabled.
if ( ! give_is_setting_enabled( give_get_meta( $atts['id'], '_give_goal_option', true ) ) ) {

Expand Down Expand Up @@ -607,6 +611,8 @@ function give_totals_shortcode( $atts ) {
'give_totals'
);

give_redirect_form_id($atts['ids']);

// Total Goal.
$total_goal = give_maybe_sanitize_amount( $atts['total_goal'] );

Expand Down Expand Up @@ -846,6 +852,8 @@ function give_form_grid_shortcode( $atts ) {
$atts
);

give_redirect_form_id($atts['ids']);

// Validate integer attributes.
$atts['forms_per_page'] = intval( $atts['forms_per_page'] );
$atts['excerpt_length'] = intval( $atts['excerpt_length'] );
Expand Down

0 comments on commit 4f1928a

Please sign in to comment.