Digests

Edit Subscribers Stopped Working - Digests

Re: Edit Subscribers Stopped Working

by neo314 » Sat Oct 05, 2019 8:17 pm

MarkDHamill wrote:Worth a try. The SQL I showed is an example of what might appear. The exact SQL will be different depending on the search pattern in the username field.

If it works on one browser but not another, that's a good sign it's a browser issue. I have to assume it's related to the hundreds of fields that can be on the screen, most of them hidden.
I did try this by restricting the number of fields on a screen to less than 5 and that did not help me. I do not think it is the number of records/fields. I think it is a JavaScript issue that the old standard in Safari does not have a problem with. Perhaps one of those things that doesn't throw an error in the console.
neo314
Registered User
Posts: 20
Joined: Thu May 22, 2008 12:09 am
Contact:

Re: Edit Subscribers Stopped Working

by MarkDHamill » Sat Oct 05, 2019 9:01 pm

Is an error being reported? If so what does it say?

Tropheus99 set up a test forum for me to use. When entering something in the search field for edit subscribers and pressing return, nothing seems to happen. Pressing the submit button renders results, but it ignores the search field. This does not happen in my development environment or on my test forum. I'm wondering if this is due to an old version of digests being used. What version are you using? It may be a bug that was closed long ago.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4885
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Edit Subscribers Stopped Working

by Tropheus99 » Sat Oct 05, 2019 9:51 pm

Hi Mark,

Just to confirm the latest version of Digests is installed on the test forum I sent you.
Tropheus99
Registered User
Posts: 29
Joined: Sat Dec 01, 2018 8:32 pm
Contact:

Re: Edit Subscribers Stopped Working

by MarkDHamill » Sat Oct 05, 2019 11:20 pm

I think the issue is the addToStack() Javascript function is failing.

The form is so dense with fields that submitting it will often trigger a max_input_vars error. To deal with this, on form submission I disable all input fields except those that were changed. Those that were changed should be added to an array called inStack, executed by an onchange() event attached to every input field. Here's the code:

Code: Select all

	// If a field was not changed, disable it so it won't be sent to the web server. This helps get around PHP's
	// max_input_var resource limitation on the Edit subscribers screen.
	$('#acp_digests').submit(function() {
		if ($('#digests').length === 1) {
			// Logic only applies on edit subscribers screen because stack won't exist otherwise. #digests is an
			// ID only on the edit subscribers screen.
			$('input, select').each(function() {
				if (!inStack($(this).attr('name'))) {
					$(this).prop('disabled', true);
				}
			});
		}
	});
I thought this was a very elegant solution when I wrote it, BTW. ;)

The function is probably not getting executed because a Javascript error occurs, as documented, errors like:
An invalid form control with name='user-4634-max_display_words' is not focusable.
So figuring out a solution to this should solve the general issue. I've done some searching on the web, and setting the form to novalidate didn't work. I encourage people to look at some of the things people have tried and see if any of them work to keep the error from happening:

https://duckduckgo.com/?q=invalid+form+ ... +focusable
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4885
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Edit Subscribers Stopped Working

by MarkDHamill » Sun Oct 06, 2019 2:22 pm

Tropheus99 wrote:Hi Mark,

Just to confirm the latest version of Digests is installed on the test forum I sent you.
Thanks. Let's try this on the test forum you set up for me:

Before line 84 of /ext/phpbbservices/digests/adm/style/acp_digests.js (this assumes you are using version 3.2.15, the latest), which is:

Code: Select all

					$(this).prop('disabled', true);
add:

Code: Select all

					$(this).prop('required', false);
Purge the cache after making the changes, although it shouldn't be necessary. Also, clear your browser's cache. Then reload the page and submit the form. Monitor the Javascript console to see if these errors still occur.
Last edited by MarkDHamill on Sun Oct 06, 2019 3:40 pm
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4885
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Edit Subscribers Stopped Working

by Tropheus99 » Sun Oct 06, 2019 3:18 pm

Hi Mark,

That seems to work! Take a look for yourself to make sure.

Thanks,

Ken.
Tropheus99
Registered User
Posts: 29
Joined: Sat Dec 01, 2018 8:32 pm
Contact:

Re: Edit Subscribers Stopped Working

by MarkDHamill » Sun Oct 06, 2019 3:34 pm

Awesome! This is a welcome fix to a known bug that I could not reproduce locally. It still doesn't make any sense to me why it happens at all because I use the same browser on my machine on two different sites yet get different behavior. I'm guessing it's some obscure integration difference in the web servers. Thanks for setting up a test environment that allowed me to troubleshoot this!
Last edited by MarkDHamill on Sun Oct 06, 2019 3:39 pm
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4885
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Edit Subscribers Stopped Working

by Tropheus99 » Sun Oct 06, 2019 3:36 pm

No problem Mark. Thanks for turning it around so quickly.
Tropheus99
Registered User
Posts: 29
Joined: Sat Dec 01, 2018 8:32 pm
Contact:

Re: Edit Subscribers Stopped Working

by caseydev » Thu Oct 10, 2019 10:15 am

Can confirm modifying the JavaScript file and adding 'novalidate' to the form tag seemed to work for me! On Digests 3.2.15 on a system with 2,600 members.
caseydev
Registered User
Posts: 7
Joined: Tue Jul 23, 2019 9:54 am
Contact:

Re: Edit Subscribers Stopped Working

by MarkDHamill » Thu Oct 10, 2019 12:27 pm

Great. I don't think the novalidate does the trick though, but the jQuery addition.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4885
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Edit Subscribers Stopped Working

by caseydev » Thu Oct 10, 2019 1:00 pm

MarkDHamill wrote:Great. I don't think the novalidate does the trick though, but the jQuery addition.
I had to add novalidate before the JQuery fix would work for me, otherwise it still just ignores my enter. Without, it returns:
An invalid form control with name='user-<various>-max_display_words' is not focusable.

I'll double check to make sure the fix is actually being applied properly on my system.
caseydev
Registered User
Posts: 7
Joined: Tue Jul 23, 2019 9:54 am
Contact:

Re: Edit Subscribers Stopped Working

by MarkDHamill » Thu Oct 10, 2019 1:13 pm

It can't hurt to add the novalidate flag to the form. Maybe that was needed too.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4885
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Edit Subscribers Stopped Working

by MarkDHamill » Thu Oct 10, 2019 6:26 pm

The best way to change the template to add the novalidate flag is to change line 99 of /ext/phpbbservices/digests/adm/style/acp_digests.html from:

Code: Select all

<form id="acp_digests" method="post" action="{{ U_ACTION }}">
to:

Code: Select all

<form id="acp_digests" method="post" action="{{ U_ACTION }}" {% if S_EDIT_SUBSCRIBERS %}novalidate{% endif %}>
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
MarkDHamill
Registered User
Posts: 4885
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: Edit Subscribers Stopped Working

by caseydev » Fri Oct 11, 2019 8:25 am

MarkDHamill wrote:The best way to change the template to add the novalidate flag is to change line 99 of /ext/phpbbservices/digests/adm/style/acp_digests.html from:

Code: Select all

<form id="acp_digests" method="post" action="{{ U_ACTION }}">
to:

Code: Select all

<form id="acp_digests" method="post" action="{{ U_ACTION }}" {% if S_EDIT_SUBSCRIBERS %}novalidate{% endif %}>
Great, works perfectly. I had to purge the cache before it appeared, and with the JQuery mod too this feature works again!
caseydev
Registered User
Posts: 7
Joined: Tue Jul 23, 2019 9:54 am
Contact: