site_user_list uses tablesort_sql to allow users to sort the table as they wish. However, when changes are made to the display settings or the filter settings, the sort information is lost due to the form submit.

The sorting information should be carried across by the form, somehow...

Comments

pukku’s picture

Status: Active » Fixed

I think I've solved this.

The relevant code is:

if (!isset($_REQUEST['sort']) and isset($_REQUEST['edit']['sort'])) {
    $_REQUEST['sort'] = $_REQUEST['edit']['sort'];
}
if (!isset($_REQUEST['order']) and isset($_REQUEST['edit']['order'])) {
    $_REQUEST['order'] = $_REQUEST['edit']['order'];
}

$form = array();
$form['#method'] = 'get';

$form['sort'] = array(
    '#type' => 'hidden',
    '#value' => $_REQUEST['sort'],
);
$form['order'] = array(
    '#type' => 'hidden',
    '#value' => $_REQUEST['order'],
);

This saves the sort and order information into the form, and when the form is received, if there is no overriding sort information, it copies it back to where tablesort_sql expects it to be.

There should be a better way to do this...

pukku’s picture

Status: Fixed » Closed (fixed)
maverickvarun’s picture

I have tried the new updated module on my 4.7 drupal site . This problem is still there , i get redirected to the front page, without sorting taking place.

pukku’s picture

Status: Closed (fixed) » Active

Hi! I'm not sure what could be causing this. Did you go to the settings for site user list and set things up? What exactly do you try to do?

Thanks,
Ricky

maverickvarun’s picture

Yes , i have done the changes in settings for the module. When i choose to see the diplayed list i get redirected to the front page and this is the link which comes up

http://localhost/drupaltest/?edit%5Bsort%5D=&edit%5Border%5D=&edit%5Bdis...

When i use the search option than again it gets redirected to front page, this time the link is

http://localhost/drupaltest/?edit%5Bsort%5D=&edit%5Border%5D=&edit%5Bdis...

pukku’s picture

Hi! This seems to be related to the use of clean urls. Specifically, if you have them turned off, it doesn't work.

I need to look at this a bit more. For right now, if you can enable clean urls, that will solve the problem.

Ricky

pukku’s picture

Status: Active » Fixed

I've just committed a change that should solve this. The problem was that with clean urls off, the 'q' information (used by Drupal to specify where you're going) was getting stomped because I'm passing parameters via GET. I discovered (and was informed about) '#name' in the process of trying to solve this, which is actually exactly what I was looking for earlier. I now set '#name' for 'q', 'sort', and 'order' so that they don't have 'edit[]' wrapped around them, and thus life is happy.

Ricky

maverickvarun’s picture

Kudos to you sir

Yes , the bug which i reported earlier is fixed

warm regards
Varun

Anonymous’s picture

Status: Fixed » Closed (fixed)