I'd love to install and review this module, but it can't be installed with composer because of the dependency issue. I've tried to add a patch to my composer.patches.json file, like this:
"drupal/address_usps": {
"Support for address 2.x": "https://git.drupalcode.org/project/address_usps/-/merge_requests/2.patch"
}
This doesn't work. Composer apparently analyzes the dependencies before applying the patch, and it aborts installation because of the failed dependency. Can anyone suggest a working method to install and patch the module in the absence of a new release?
The config above produces a view that says I have n unique visitors, but it doesn't specifically identify them. That addresses the request as described above. My mistake, sorry.
I was trying to produce a view that lists those unique visitors in a table, aggregating them by IP address or unique visitor ID, and showing me that IP address along with the timestamp and URL of their most recent visit. My view comes close to that, but it fails to aggregate the visits. Back to the drawing board...
You can create a view.
Please say more. I just tried to create a view, and with aggregation disabled I see a unique ID for each visitor. When I enable aggregation and use the "Count Distinct" option for the Unique Visitor field, I get a value of "1" in the field and the records aren't aggregated. Maybe I'm doing something wrong, but I don't know what. I've also added the timestamp, IP address, and URL fields to the view. Here's my view config:
uuid: 6f395cd4-37b8-47ba-a749-a8dc070506c8
langcode: en
status: true
dependencies:
module:
- visitors
id: online_visitors
label: 'Online Visitors'
module: views
description: ''
tag: ''
base_table: visitors
base_field: ''
display:
default:
id: default
display_title: Default
display_plugin: default
position: 0
display_options:
title: 'Online Visitors'
fields:
visitor_id:
id: visitor_id
table: visitors
field: visitor_id
relationship: none
group_type: count_distinct
admin_label: ''
plugin_id: standard
label: 'Unique visitor'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
set_precision: false
precision: 0
decimal: .
separator: ','
format_plural: 0
format_plural_string: !!binary MQNAY291bnQ=
prefix: ''
suffix: ''
visitors_date_time:
id: visitors_date_time
table: visitors
field: visitors_date_time
relationship: none
group_type: group
admin_label: ''
plugin_id: date
label: 'Visitors Date Time'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
date_format: fallback
custom_date_format: ''
timezone: ''
visitors_ip:
id: visitors_ip
table: visitors
field: visitors_ip
relationship: none
group_type: group
admin_label: ''
plugin_id: standard
label: 'Visitors IP'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
set_precision: false
precision: 0
decimal: .
separator: ','
format_plural: false
format_plural_string: !!binary MQNAY291bnQ=
prefix: ''
suffix: ''
visitors_url:
id: visitors_url
table: visitors
field: visitors_url
relationship: none
group_type: group
admin_label: ''
plugin_id: standard
label: 'Visitors URL'
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
pager:
type: full
options:
offset: 0
pagination_heading_level: h4
items_per_page: 20
total_pages: null
id: 0
tags:
next: 'Next βΊ'
previous: 'βΉ Previous'
first: 'Β« First'
last: 'Last Β»'
expose:
items_per_page: false
items_per_page_label: 'Items per page'
items_per_page_options: '5, 10, 25, 50'
items_per_page_options_all: false
items_per_page_options_all_label: '- All -'
offset: false
offset_label: Offset
quantity: 9
exposed_form:
type: basic
options:
submit_button: Apply
reset_button: false
reset_button_label: Reset
exposed_sorts_label: 'Sort by'
expose_sort_order: true
sort_asc_label: Asc
sort_desc_label: Desc
access:
type: none
options: { }
cache:
type: tag
options: { }
empty: { }
sorts: { }
arguments: { }
filters:
visitors_date_time:
id: visitors_date_time
table: visitors
field: visitors_date_time
relationship: none
group_type: group
admin_label: ''
plugin_id: visitors_date
operator: '>='
value:
min: ''
max: ''
value: '-1 hour'
type: offset
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
operator_limit_selection: false
operator_list: { }
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
min_placeholder: ''
max_placeholder: ''
placeholder: ''
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
style:
type: table
options:
grouping: { }
row_class: ''
default_row_class: true
columns:
visitors_date_time: visitors_date_time
visitors_ip: visitors_ip
visitors_url: visitors_url
default: visitors_date_time
info:
visitors_date_time:
sortable: true
default_sort_order: desc
align: ''
separator: ''
empty_column: false
responsive: ''
visitors_ip:
sortable: false
default_sort_order: desc
align: ''
separator: ''
empty_column: false
responsive: ''
visitors_url:
sortable: false
default_sort_order: asc
align: ''
separator: ''
empty_column: false
responsive: ''
override: true
sticky: false
summary: ''
empty_table: false
caption: ''
description: ''
row:
type: fields
query:
type: views_query
options:
query_comment: ''
disable_sql_rewrite: false
distinct: false
replica: false
query_tags: { }
relationships: { }
group_by: true
header: { }
footer: { }
display_extenders: { }
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
- url.query_args
tags: { }
block_1:
id: block_1
display_title: Block
display_plugin: block
position: 1
display_options:
display_extenders: { }
block_description: 'Online Visitors'
cache_metadata:
max-age: -1
contexts:
- 'languages:language_interface'
- url.query_args
tags: { }
Looking a little deeper: as described in VisitorsCookieInterface.php, the getId() function is supposed to return a string. $visitor_id does not have an initial value. Doing this:
[$visitor_id] =...
sets the value of an array element with an undefined index. The function then returns $visitor_id, which has no value. Maybe this is the right thing to do:
$visitor_id = is_string($_pk_id) ? $_pk_id : "";
return $visitor_id;
This ensures that the value of $visitor_id is set to a string value.
Sorry, but I just saw this in my watchdog log:
Warning: Undefined array key 0 in Drupal\visitors\Service\CookieService->getId() (line 40 of /var/www/mysite/web/modules/contrib/visitors/src/Service/CookieService.php)
I believe the code should be changed from this:
[$visitor_id] = is_string($_pk_id) ? explode('.', $_pk_id) : [];
return $visitor_id;
to this:
$visitor_id = is_string($_pk_id) ? explode('.', $_pk_id) : [];
return $visitor_id;
Thanks for the quick replies. I can confirm that the approach described above eliminates the problem.
sah62 β created an issue.
It's definitely using an HTTP GET. I just confirmed that by looking at a sample in my nginx log:
40.77.190.63 - - [03/Jun/2024:08:14:10 -0400] "GET /visitors/_track?action_name=...
I guess this means that there's no visitors error here. No, I don't see it being logged by the module. Thanks for the help, @bluegeek9.
I've noticed that the errors are all associated with Microsoft Bing bot IP addresses. Could a crawler be doing something unexpected?
Thanks for such a quick reply!
What was the previous version installed?
8.x-2.16 was previously installed. I had uninstalled that version (using "drush pmu") while waiting for this new release, so this was basically a fresh installation.
Have you cleared the cache? The error is, No route found. It is referring to the path/route Visitors logs the visit. The data is sent as a POST
Yes, after using composer to install the update I ran both "drush updb" and "drush cr". I've since flushed all caches again, and the errors still appear.
Does the site have a path prefix? https://www.mysite.com/test
No, there's no path prefix like that. If it helps, here's the complete location given for one of the logged errors (with minor edits to redact the actual site name):
https://www.mysite.com/visitors/_track?_cvar=%7B%227%22%3A%5B%22route%22...
Looks good to me.
sah62 β created an issue.
Thanks for the reply! Yes, sorry, I believe this is an issue, or also an issue, for the XML Sitemap module. Please move it as appropriate.
1. The type is "xmlsitemap".
2. The URL I see on my site to enable or disable submission to Google is this one:
https://www.mysite.com/admin/config/search/xmlsitemap/engines
3. Yes, I'm using the XML Sitemap module. It's checked on the /admin/modules
page.
4. My preference would be for sitemap submission to work without error. Given what I read in the Google blog, I believe this means "stop pinging Google AND modify robots.txt to include a Sitemap line" as you described.
In the meantime I can disable sitemap submission by uninstalling the XML Sitemap Engines module.
Fix confirmed. I haven't seen any errors since deploying the patch.
sah62 β created an issue.
I've been using the patch since I posted it. It's been working fine for me.
I've seen it in 9.3.2, too.
Patch attached.
The patch in #13 works for me.
Here's a patch.
Moving this to Commerce PayPal.
I posted this same question on StackExchange after not getting any feedback here:
https://drupal.stackexchange.com/questions/317446/user-error-funding-sou...
A response received there may contain the needed fix. This appears to be a Commerce PayPal issue. Here's the suggestion:
To create a valid render array, put the string the function returns in a markup render element:
$variables['order']['funding_source'] = ['#markup' => commerce_paypal_funding_source_label($data['funding_source'])];
That's in file commerce_paypal/commerce_paypal.module. I've made the change and am still testing to see if it solves the problem. If it does, this issue should be move to the Commerce PayPal issue queue with the fix included as a patch.
I tried re-installing a second time, but this time I made sure to completely uninstall first. As noted by @Janner, this seems to have solved the problem. I'm not seeing any more errors or warnings. I did have to go back and re-adjust my site settings, though.
I tried reinstalling. It didn't help. Ticket opened.
I'm using nginx/1.18.0. I have client_max_body_size set to 500M in nginx.conf.
I found a small typo in the patch: there's an extra "&" in the description of "USPS Ground Advantage& Parcel Locker". Here's a new patch with that extra character removed.
I've attached a patch that replaces the old service descriptions with the new service descriptions returned from the USPS web service. It works for my store; please review the changes and let me know if I missed anything.
The patches are working for me. Let's get this reviewed.
Would something like this work to mark an order item each time is payment is processed?
foreach ($payment->getOrder()->getItems() as $item) {
$square_item_processed = $item->getData('square_item_processed', FALSE);
if ($square_item_processed) continue;
// Process the order item.
...
$item->setData('square_item_processed', TRUE);
}
I've tried to test this idea. Nothing "bad" seems to happen when I process a first payment for a single item. If I edit the order and add an item, though, when I try to process the second payment the value of $square_item_processed is FALSE for both items in the order and the payment process fails because the amount of the order (2 items, plus tax, plus shipping) doesn't match the payment (1 new item plus tax). I'm clearly still missing something.
Am I correct in assuming that some of these instructions are intended for module developers, and some are intended for site administrators? For example, "migrate to the new template" appears to be a developer instruction. There's no GUI for it that I can find so there's nothing I can do as a site administrator, but I understand how a module developer would need to switch if their module is sending email.
I just did some testing with my existing webform configuration in which email with attachments is sent. It still works just fine, without changing anything, after configuring Symfony Mailer (with import of my Swift Mailer settings) and removing the legacy applications.
One last question: at what point can I (or should I?) disable the "Emulate swiftmailer" option as a site administrator?
Thanks again!