-
Notifications
You must be signed in to change notification settings - Fork 571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fatal error: Uncaught Error: Unknown format specifier "A" #1503
Comments
I wonder what's coming in as parto f the |
I guess after Google redirects the page URL: The CMB checks for the submission values. Is there a way to skip that? or do I need to disable the plugin? When I comment out the 344 line, there is no error and the page is displayed. |
|
Thanks for the answer but I don't want cmb2 form to interfere with the Google-authenticated redirect. I have never worked with cmb2 before, is there a way I can fix that apart from disabling it? Since the client is using a theme dependent on CMB2. |
There's nothing in the CMB2 code causing this. My comment was explaining the ways our code is used and the ways it could be being used incorrectly. |
Yeah, sure. <?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
wp_enqueue_style( 'dashicons' );
?>
<div class="profile-form-wrapper box-dashboard-wrapper">
<div class="edit-profile-section">
<h3 class="title"><?php esc_html_e('Edit Profile','freeio') ?></h3>
<div class="social-login">
<div class="youtube-login-container login-container">
<?php echo do_shortcode( '[eroyalties-youtube-login]' ); ?>
</div>
<div class="facebook-login-container login-container">
<?php echo do_shortcode( '[eroyalties-facebook-login]' ); ?>
</div>
<div class="tiktok-login-container login-container">
<?php echo do_shortcode( '[eroyalties-tiktok-login]' ); ?>
</div>
</div>
</div>
<?php
if ( WP_Freeio_User::is_freelancer() ) {
$post_status = get_post_status($post_id);
if ( $post_status == 'pending' || $post_status == 'pending_approve' ) {
?>
<div class="alert alert-danger"><?php esc_html_e('Your resume has to be confirmed by an administrator before publish.', 'freeio'); ?></div>
<?php
do_action('wp-freeio-resume-form-status-pending', $post_status, $post_id);
} elseif ( $post_status == 'expired' ) {
?>
<div class="alert alert-danger"><?php esc_html_e('Your resume has expired.', 'freeio'); ?></div>
<?php
do_action('wp-freeio-resume-form-status-expired', $post_status, $post_id);
}
do_action('wp-freeio-resume-form-status', $post_status, $post_id);
}
if ( ! empty( $_SESSION['messages'] ) ) : ?>
<div class="inner-list">
<ul class="messages">
<?php foreach ( $_SESSION['messages'] as $message ) { ?>
<?php
$status = !empty( $message[0] ) ? $message[0] : 'success';
if ( !empty( $message[1] ) ) {
?>
<li class="message_line <?php echo esc_attr( $status ) ?>">
<?php echo trim( $message[1] ); ?>
</li>
<?php
}
}
unset( $_SESSION['messages'] );
?>
</ul>
</div>
<?php endif; ?>
<?php
echo cmb2_get_metabox_form( $metaboxes_form, $post_id, array(
'form_format' => '<form action="' . esc_url(WP_Freeio_Mixes::get_full_current_url()) . '" class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s
<div class="submit-button-wrapper"><button type="submit" name="submit-cmb-profile" value="%4$s" class="btn btn-theme btn-inverse">%4$s <i class="flaticon-right-up next"></i></button></div></form>',
'save_button' => esc_html__( 'Save Profile', 'freeio' ),
) );
?>
</div> |
Yah, the issue is in the line: 'form_format' => '<form action="' . esc_url(WP_Freeio_Mixes::get_full_current_url()) . '" … In the default form_format, we do not set the action at all. But here, they are setting it to the current url, and the current url contains some characters which look like PHP format specifiers, but are actually not (e.g. If that's not an option, you can use this code to "fix" the action url: add_filter( 'cmb2_get_metabox_form_format', function( $form_format ) {
if ( ! isset( $_GET['code'] ) ) {
return $form_format;
}
$parts = explode( 'action="', $form_format, 2 );
$before = $parts[0] . 'action="';
$parts = explode( '"', $parts[1], 2 );
// Remove the query args from the action URL.
$url = explode( '?', $parts[0], 2 )[0];
$after = '"' . $parts[1];
return $before . esc_url( $url ) . $after;
return $form_format;
} ); |
Thanks, @jtsternberg You are a star. Much appreciated! |
Hey devs,
I am working on a client's site and when I try to redirect from the Google sign-in page there is a code added to the URL. The site is using PHP 8.0+.
The plugin creates an error and the page does not load. What is a good solution? I guess it is because there is a conflict between the CMB form submission and the Google authentication code.
The function that it points to Line 344 is
printf( $format_parts[0], esc_attr( $cmb->cmb_id ), esc_attr( $object_id ) );
The text was updated successfully, but these errors were encountered: