Post Reply 
 
Thread Rating:
  • 0 Votes - 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.)
Post: #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 File(s)
.php  UserSettings.php (Size: 9.48 KB / Downloads: 2)

https://www.linkedin.com/in/eclipsepaulbecker
Visit this user's website Find all posts by this user
Quote this message in a reply
02-08-2018, 06:12 AM (This post was last modified: 02-08-2018 06:25 AM by TurboPT.)
Post: #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?
Find all posts by this user
Quote this message in a reply
02-08-2018, 06:23 AM
Post: #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
Visit this user's website Find all posts by this user
Quote this message in a reply
02-08-2018, 06:27 AM (This post was last modified: 02-08-2018 06:30 AM by TurboPT.)
Post: #4
RE: User Settings - Missing Value
Yes, found it. We must have posted at the same time! (I updated my post #2)
Find all posts by this user
Quote this message in a reply
02-08-2018, 06:43 AM (This post was last modified: 02-08-2018 06:46 AM by TurboPT.)
Post: #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.
Find all posts by this user
Quote this message in a reply
02-08-2018, 06:45 AM
Post: #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
Visit this user's website Find all posts by this user
Quote this message in a reply
02-08-2018, 06:58 AM
Post: #7
RE: User Settings - Missing Value
Thank you!

https://www.linkedin.com/in/eclipsepaulbecker
Visit this user's website Find all posts by this user
Quote this message in a reply
02-08-2018, 07:08 AM (This post was last modified: 02-08-2018 08:23 AM by TurboPT.)
Post: #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.
Find all posts by this user
Quote this message in a reply
02-08-2018, 07:13 AM
Post: #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
Visit this user's website Find all posts by this user
Quote this message in a reply
02-08-2018, 07:28 AM
Post: #10
RE: User Settings - Missing Value - SOLVED
Changes committed to SVN.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)