Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
User Settings - Missing Value - SOLVED
02-08-2018, 05:11 AM, (This post was last modified: 02-08-2018, 06:58 AM by VortecCPI.)
#1
User Settings - Missing Value - SOLVED
UserSettings.php

Does not show value in displayrecordsmax field in www_users table.

Attached is my crack at a fix...


Attached Files
.php   UserSettings.php (Size: 9.48 KB / Downloads: 2)
https://www.linkedin.com/in/eclipsepaulbecker
Reply
02-08-2018, 06:12 AM, (This post was last modified: 02-08-2018, 06:25 AM by TurboPT.)
#2
RE: User Settings - Missing Value
Paul, unless there possibly more to this picture, I do not see the same issue without modification?

When I go to user settings, the Display Max had 50 in the field.
I changed that to 55, clicked Modify, and the www_users table reflected 55.
Then changed again to 60, clicked Modify, and the table column reflected 60.

Is there more to know?

It seems that lines 109-111 (in the existing file) is part of the (initial) handling?

=====

UPDATE:

Never mind, I think I found it. Although the value saves to the table, upon RETURN to the user's settings, then the field Display Max field shows 50 again, instead of the table value, as in my example, should have been 60... is this correct?
Reply
02-08-2018, 06:23 AM,
#3
RE: User Settings - Missing Value
Now go back to the User Settings page and you will see it always shows 50 no matter what is in the table.
https://www.linkedin.com/in/eclipsepaulbecker
Reply
02-08-2018, 06:27 AM, (This post was last modified: 02-08-2018, 06:30 AM by TurboPT.)
#4
RE: User Settings - Missing Value
Yes, found it. We must have posted at the same time! (I updated my post #2)
Reply
02-08-2018, 06:43 AM, (This post was last modified: 02-08-2018, 06:46 AM by TurboPT.)
#5
RE: User Settings - Missing Value
I believe that the change may be easier than expected.

I made this minor change, and then 60 appears as expected for me:

Change this:
PHP Code:
If (!isset($_POST['DisplayRecordsMax']) OR $_POST['DisplayRecordsMax']=='') {
    
$_POST['DisplayRecordsMax'] = $_SESSION['DefaultDisplayRecordsMax'];


...to this:
PHP Code:
If (!isset($_POST['DisplayRecordsMax']) OR $_POST['DisplayRecordsMax']=='') {
    
$_POST['DisplayRecordsMax'] = $_SESSION['DisplayRecordsMax']; // session index change

POST will never be set when first entering the script, and the 'DefaultDisplayRecordsMax' will always be 50 (or whatever that setting might have).

The 'DisplayRecordsMax' is set at UserLogin (lines 123-127), and in the UserSettings file the same field is updated after Modify at line 94.
Reply
02-08-2018, 06:45 AM,
#6
RE: User Settings - Missing Value
Paul T I remember solving this in my code a while back. Unfortunately I am not at my computer right now but if you look back at that file in my github repository you should see the solution.

Tim
Reply
02-08-2018, 06:58 AM,
#7
RE: User Settings - Missing Value
Thank you!
https://www.linkedin.com/in/eclipsepaulbecker
Reply
02-08-2018, 07:08 AM, (This post was last modified: 02-08-2018, 08:23 AM by TurboPT.)
#8
RE: User Settings - Missing Value
Yes, Tim, I had a look...

What your code has is an improvement of existing handling, but we basically have the same change.

The conditional block that I added to post 5 can be eliminated, and use the $_SESSION['DisplayRecordsMax'] directly to set the 'value' as your code has, instead of populating the POST (in the condition) and then use the POST to set the 'value'.

=====

Paul B., so the post 5 change can be ignored, as that entire condition block will be eliminated, but the new handling is:

Change line 123 from this:
PHP Code:
<td><input class="integer" maxlength="3" name="DisplayRecordsMax" required="required" size="3" title="', _('The input must be positive integer'), '" type="text" value="', $_POST['DisplayRecordsMax'], '" /></td

...to this: (near the end)
PHP Code:
<td><input class="integer" maxlength="3" name="DisplayRecordsMax" required="required" size="3" title="', _('The input must be positive integer'), '" type="text" value="', $_SESSION['DisplayRecordsMax'], '" /></td
I'll commit the changes in just a moment.
Reply
02-08-2018, 07:13 AM,
#9
RE: User Settings - Missing Value - SOLVED
Yes, using DisplayRecordsMax was the fix it applied that reminded me. In fact it came to light because of a post the other Paul made to this forum about the number of displayed records. Thanks for thememory prompt Smile
Reply
02-08-2018, 07:28 AM,
#10
RE: User Settings - Missing Value - SOLVED
Changes committed to SVN.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)