Search Event is not decoded in search bar
-
Hello Team
I have found an issue on events page,
when i search any events it takes url value in search bar and in message as well
Please look into this https://prnt.sc/P81jUG8vJCPe
-
Can you fix code here:
For Search bar https://prnt.sc/yc9J9p1S0nJr , value should be as below in file template :
src/views/v2/components/events-bar/search/keyword.phpvalue="<?php echo esc_attr( urldecode( tribe_events_template_var( [ 'bar', 'keyword' ], '' ) ) ); ?>"
/* translators: %s: events (plural). */
$placeholder = sprintf( __( 'Search for %s', 'the-events-calendar' ), tribe_get_event_label_plural_lowercase() );
/* translators: %s: events (plural). */
$aria_label = sprintf( __( 'Enter Keyword. Search for %s by Keyword.', 'the-events-calendar' ), tribe_get_event_label_plural_lowercase() );
?>
<div
class="tribe-common-form-control-text tribe-events-c-search__input-control tribe-events-c-search__input-control--keyword"
data-js="tribe-events-events-bar-input-control"
>
<label class="tribe-common-form-control-text__label" for="tribe-events-events-bar-keyword">
<?php printf( esc_html__( 'Enter Keyword. Search for %s by Keyword.', 'the-events-calendar' ), tribe_get_event_label_plural() ); ?>
</label>
<input
class="tribe-common-form-control-text__input tribe-events-c-search__input"
data-js="tribe-events-events-bar-input-control-input"
type="text"
id="tribe-events-events-bar-keyword"
name="tribe-events-views[tribe-bar-search]"
value="<?php echo esc_attr( urldecode( tribe_events_template_var( [ 'bar', 'keyword' ], '' ) ) ); ?>"
placeholder="<?php echo esc_attr( $placeholder ); ?>"
aria-label="<?php echo esc_attr( $aria_label ); ?>"
/>
<?php $this->template( 'components/icons/search', [ 'classes' => [ 'tribe-events-c-search__input-control-icon-svg' ] ] ); ?>
</div>For Message response (https://prnt.sc/rdzBiJxjNI57) , you need to make modification in below file
FIle path : src/Tribe/Views/V2/Messages.phppublic static function for_key($key, ...$values) {
$map = [
'no_results_found' => __(
'There were no results found.',
'the-events-calendar'
),
'no_upcoming_events' => sprintf(
_x(
'There are no upcoming %1$s.',
'A message to indicate there are no upcoming events.',
'the-events-calendar'
),
tribe_get_event_label_plural_lowercase()
),
'month_no_results_found' => __(
'Test 4 There were no results found for this view.',
'the-events-calendar'
),
'no_results_found_w_keyword' => __(
'Test 1 There were no results found for <strong>"%1$s"</strong>.',
'the-events-calendar'
),
'month_no_results_found_w_keyword' => __(
'Test 2 There were no results found for <strong>"%1$s"</strong> this month.',
'the-events-calendar'
),
'day_no_results_found' => __(
'No %1$s scheduled for %2$s.',
'the-events-calendar'
),
'month_no_results_found_w_ff_link' => __(
'Test 3 There were no results found for this view. %1$s',
'the-events-calendar'
),
'day_no_results_found_w_ff_link' => __(
'No %1$s scheduled for %2$s. %3$s',
'the-events-calendar'
),
];
$map = apply_filters('tribe_events_views_v2_messages_map', $map);
$match = Arr::get($map, $key, $key);
if (empty($values)) {
return $match;
}
$need_events_label_keys = ['day_no_results_found', 'day_no_results_found_w_ff_link'];
$need_events_label_keys = apply_filters('tribe_events_views_v2_messages_need_events_label_keys', $need_events_label_keys);
if (in_array($key, $need_events_label_keys)) {
array_unshift($values, tribe_get_event_label_plural_lowercase());
}
// Decode URL-encoded values
$decoded_values = array_map('urldecode', $values);
return sprintf($match, ...$decoded_values);
}Thank you!
Hi @krips
Thanks for reaching out and for sharing your finds about this issue.
For us to check the issue further, could you provide a screenshot again? It appears, it’s not working on my end.
See- https://share.zight.com/DOuEYOPGSorry for late reply,
For Message appears below search bar which need to decoded as well as in search bar
https://drive.google.com/file/d/1CWoHBWvZVDLT23pAWhQ6_UxCiUjd__Rz/view?usp=drive_link
https://drive.google.com/file/d/1vxhEyavXQGM_ouLjdbGN1OVWpXmvMg5h/view?usp=drive_linkHi @krips ,
Thank you for your message and the information.
The shared files doesn’t seem to be available publicly. Could you share it to users with theeventscalendar.com domain, at least (see https://support.google.com/a/answer/60781?sjid=3506021163923716360-AP#restrict_sharing_to_domains)?
Hi there,
It appears that we haven’t heard back from you in a while, so I’ll assume that the matter has been resolved. If you need any more help, feel free to start a new thread and we’ll be happy to assist you.
Sorry, Now you will be able to access the links
Hi Krips,
I tried replicating the issue on my end, but it’s working as expected. I did not encounter the encoded characters when I search for a keyword that has a colon (:) and a comma “,”.
Could I ask for the URL of your calendar, and the versions of your plugins? I want to check the issue further on my end.
Also, it’s possible that there’s a conflict between one of your plugins/themes. To check this, would you be able to run a conflict test? I recommend doing this on a staging version of your website. Additionally, please ensure that you have the most recent version of the plugin installed.
Looking forward to your reply.
Hi there,
I hope everything is going smoothly for you. I just wanted to touch base and inquire if you had the opportunity to review my previous response as it has been some time since we last heard from you.
Let me know if there’s anything I can assist you with.
Hi there,
It seems like it has been some time since we received a response from you, therefore, I will consider this matter as resolved. If you require any further assistance, please do not hesitate to start a new thread.
- You must be logged in to reply to this topic.