[fixed] v2.10.10 - Attributes order of listing not working

Discuss, research, share, find, and solve bugs

[fixed] v2.10.10 - Attributes order of listing not working

Postby H2B2 » 4:05pm, Thu 07 May, 2009

Split from: viewtopic.php?f=10&t=24498
spidersilk wrote:Oh, one other question, while I'm on attributes -- I've created a subscribe page, but the attributes on it seem to be showing up in reverse order. I set the display order to what I wanted it to be (first name, last name, country, Canadian province, US state) both in the global attributes settings and in the subscribe page settings (though it doesn't appear to save them there), but it kept displaying them backwards. So I tried reversing the numbers, putting 5 for the one that was supposed to be first and so on down to 1 for the last, but that didn't make any difference. Am I doing something wrong, or is the display order feature just not implemented yet or something?

Normally, you should be able to set the order of listing of attributes on the lists/admin/?page=spageedit&id=1 page by entering numbers starting from 0 in the appropriate box. I just checked with v2.10.10 and I can confirm the script doesn't seem to save the new order of listing. This might be a bug. Which version are you running?

As a workaround solution you could use the custom subscribe form method mentioned above, which should allow placing the attributes anywhere you want on the form.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Re: Attributes dependent on other attributes?

Postby spidersilk » 5:18pm, Thu 07 May, 2009

I'm running 2.10.10 -- I just downloaded and installed it yesterday, though I'd experimented a bit with past versions on other sites before.

The attribute order glitch is not just when editing the subscribe page -- the order set when editing the global attributes does appear to be saved, but then comes out reversed on the page.
spidersilk
phpLister
 
Posts: 6
Joined: 8:32am, Tue 25 Apr, 2006
Location: Toronto, ON, Canada

Re: V2.10.10 - Attributes order of listing not working

Postby H2B2 » 1:29am, Tue 12 May, 2009

H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Re: v2.10.10 - Attributes order of listing not working

Postby mikeb » 3:46pm, Tue 02 Jun, 2009

I applied the bug fixes and it does not fix the problem. My listorder is correct in the user_attributes and the subscribepage_data also has the required attributes and sequence but they do not appear in the correct order. Your changes did create a different look and closer to correct but the attributes still appear out of order. I wonder if your success was due to random sequencing that just happened to work in your application. Any ideas?
mikeb
phpLister
 
Posts: 7
Joined: 8:12pm, Wed 27 May, 2009

Re: v2.10.10 - Attributes order of listing not working

Postby tipichris » 7:58am, Mon 08 Jun, 2009

Try the mantis bug report again:

http://mantis.phplist.com/view.php?id=15285

I've posted a patch there. On my system at least this is register_globals issue. Despite the fact that PHPList appears to be include code to warn you if you have register_globals on, and code to force it off, there are several places where the code appears to assume that it is on. This is one of those.

Here's the patch to spageedit.php that solved the issue for me

Code: Select all
--- lists/admin/spageedit.php.orig      Fri May 29 21:42:49 2009
+++ lists/admin/spageedit.php   Sun May 31 20:32:45 2009
@@ -54,9 +54,9 @@
   if (isset($_POST['attr_use']) && is_array($_POST['attr_use'])) {
     $cnt=0;
     while (list($att,$val) = each ($_POST['attr_use'])) {
-      $default = $attr_default[$att];
-      $order = $attr_listorder[$att];
-      $required = $attr_required[$att];
+      $default = $_POST['attr_default'][$att];
+      $order = $_POST['attr_listorder'][$att];
+      $required = $_POST['attr_required'][$att];

       Sql_Query(sprintf('insert into %s (id,name,data) values(%d,"attribute%03d","%s")',
         $tables["subscribepage_data"],$id,$att,
@@ -73,11 +73,11 @@
   }
   if (ENABLE_RSS) {
     Sql_Query(sprintf('replace into %s (id,name,data) values(%d,"rssintro","%s")',
-       $tables["subscribepage_data"],$id,$rssintro));
+       $tables["subscribepage_data"],$id,$_POST['rssintro']));
     Sql_Query(sprintf('replace into %s (id,name,data) values(%d,"rss","%s")',
-       $tables["subscribepage_data"],$id,join(',',$rss)));
+       $tables["subscribepage_data"],$id,join(',',$_POST['rss'])));
     Sql_Query(sprintf('replace into %s (id,name,data) values(%d,"rssdefault","%s")',
-       $tables["subscribepage_data"],$id,$rssdefault));
+       $tables["subscribepage_data"],$id,$_POST['rssdefault']));
   }
   if (!empty($_POST['activate'])) {
     Sql_Query(sprintf('update %s set active = 1 where id = %d',



There is a similar issue in viewtemplate.php

Code: Select all
--- lists/admin/viewtemplate.php.orig   Fri Jun  5 20:10:42 2009
+++ lists/admin/viewtemplate.php        Fri Jun  5 20:17:20 2009
@@ -12,7 +12,7 @@
   print '<p>'.PageLink2("template&id=".$_GET["id"],$GLOBALS['I18N']->get('BackEditTemp')).'</p>';
 } else {
   ob_end_clean();
-  print previewTemplate($id,$_SESSION["logindetails"]["id"],nl2br($GLOBALS['I18N']->get('TempSample')));
+  print previewTemplate($_GET['id'],$_SESSION["logindetails"]["id"],$GLOBALS['I18N']->get('TempSample'));
 }

 ?>
tipichris
phpLister
 
Posts: 11
Joined: 9:03pm, Wed 03 Jun, 2009

Re: v2.10.10 - Attributes order of listing not working

Postby mikeb » 8:28pm, Mon 08 Jun, 2009

I posted your new fix but the subscribe page is still not sequenced correctly. I have 11 attributes which have the correct list order value in user_attributes. However, when used on the subscribe page (Everything) they appear in "random" order. Looking at subscribepage_data I see attribute sequence for the subscribe page for Everything as 1+13+14+2+3+4+5+6+10+9+11+12+ (ID of attribute records) which is the correct sequence as defined by the list order. However, the actual sequence on the subscribe page for Everything is 1, 3, 2, 14, 13, 11, 9, 6, 10.
mikeb
phpLister
 
Posts: 7
Joined: 8:12pm, Wed 27 May, 2009

Re: v2.10.10 - Attributes order of listing not working

Postby sol001 » 3:34am, Thu 18 Jun, 2009

stupid question maybe but how do you apply the bug fix?
OK I answered my own question:

Just replace the lines mentioned (delete the - lines and swap for the + lines!)
sol001
PL Nut
 
Posts: 18
Joined: 9:20am, Fri 22 Feb, 2008

Re: v2.10.10 - Attributes order of listing not working

Postby yogoo » 11:26am, Wed 01 Jul, 2009

Running into the exact same issue as "spidersilk" quoted in the original post, I digged a bit and found the following:

- custom form is not the solution because the attributes are still listed in a different order on the preference page... url is "lists/?p=preferences&uid=" and as far as I know we cannot set up custom form there (would be nice to be able to...).

- it looks like PHPList orders the attributes according to the custom order, and then re-order them in a different fashion. The function doing that is located in /lists/admin/connect.php and named "PageAttributes($data)".

Here is a quick fix:

File: /lists/admin/connect.php
Change:
Code: Select all
L873      if (isset ($sorted) && is_array($sorted)) {
L874         $attributes = $sorted;
L875      asort($attributes);
L876      }

into
Code: Select all
      if (isset ($sorted) && is_array($sorted)) {
         $attributes = $sorted;
      #asort($attributes);
      }

The fix consists in commenting out L875.

I have not investigated why $attributes is sorted again using "asort()". So use at your own risks.
yogoo
phpList newbie
 
Posts: 3
Joined: 9:16pm, Sat 13 Jun, 2009

Re: v2.10.10 - Attributes order of listing not working

Postby highwaykind » 7:49am, Mon 06 Jul, 2009

tipichris wrote:
Code: Select all
--- lists/admin/spageedit.php.orig      Fri May 29 21:42:49 2009
+++ lists/admin/spageedit.php   Sun May 31 20:32:45 2009
@@ -54,9 +54,9 @@
   if (isset($_POST['attr_use']) && is_array($_POST['attr_use'])) {
     $cnt=0;
     while (list($att,$val) = each ($_POST['attr_use'])) {
-      $default = $attr_default[$att];
-      $order = $attr_listorder[$att];
-      $required = $attr_required[$att];
+      $default = $_POST['attr_default'][$att];
+      $order = $_POST['attr_listorder'][$att];
+      $required = $_POST['attr_required'][$att];

       Sql_Query(sprintf('insert into %s (id,name,data) values(%d,"attribute%03d","%s")',
         $tables["subscribepage_data"],$id,$att,
@@ -73,11 +73,11 @@
   }
   if (ENABLE_RSS) {
     Sql_Query(sprintf('replace into %s (id,name,data) values(%d,"rssintro","%s")',
-       $tables["subscribepage_data"],$id,$rssintro));
+       $tables["subscribepage_data"],$id,$_POST['rssintro']));
     Sql_Query(sprintf('replace into %s (id,name,data) values(%d,"rss","%s")',
-       $tables["subscribepage_data"],$id,join(',',$rss)));
+       $tables["subscribepage_data"],$id,join(',',$_POST['rss'])));
     Sql_Query(sprintf('replace into %s (id,name,data) values(%d,"rssdefault","%s")',
-       $tables["subscribepage_data"],$id,$rssdefault));
+       $tables["subscribepage_data"],$id,$_POST['rssdefault']));
   }
   if (!empty($_POST['activate'])) {
     Sql_Query(sprintf('update %s set active = 1 where id = %d',



This fixed the order for me, thanks!
highwaykind
phpLister
 
Posts: 7
Joined: 10:56am, Thu 02 Jul, 2009

Re: v2.10.10 - Attributes order of listing not working

Postby bmp500 » 12:57am, Thu 09 Jul, 2009

I'm having the same problem with attribute order not being retained as set in the subscription page.

Also - the "required" checkbox for the attributes is not being retained - I cannot set an attribute as Required because the setting seems to be cleared upon saving (much like the ordering).
bmp500
phpList newbie
 
Posts: 1
Joined: 12:51am, Thu 09 Jul, 2009

Re: v2.10.10 - Attributes order of listing not working

Postby Cortex » 2:38pm, Fri 17 Jul, 2009

Same for me. Display order and "required" attribute are not saved upon saving through the interface. phplist 2.10.10

Any chance the problem will be fixed soon by an official release ?
Cortex
phpList newbie
 
Posts: 1
Joined: 2:31pm, Fri 17 Jul, 2009

Re: v2.10.10 - Attributes order of listing not working

Postby testbot » 6:52pm, Mon 27 Jul, 2009

i try to apply that patch but get the following

patching file lists/admin/spageedit.php
Hunk #1 FAILED at 54.
Hunk #2 FAILED at 73.
2 out of 2 hunks FAILED -- saving rejects to file lists/admin/spageedit.php.rej
testbot
phpLister
 
Posts: 13
Joined: 4:01am, Sun 05 Apr, 2009
Location: Chicago

Re: v2.10.10 - Attributes order of listing not working

Postby yardcat » 11:04pm, Sun 02 Aug, 2009

So, I think I should apply the patchs presented on this subject but I could not locate spageedit.php. Can someone point me to this file?
Thanks, Arden
yardcat
phpList newbie
 
Posts: 3
Joined: 11:00pm, Sun 02 Aug, 2009

Re: v2.10.10 - Attributes order of listing not working

Postby omejan » 5:57pm, Tue 11 Aug, 2009

File is located in the admin folder
omejan
phpList newbie
 
Posts: 1
Joined: 10:35am, Tue 11 Aug, 2009

Re: v2.10.10 - Attributes order of listing not working

Postby H2B2 » 2:24am, Fri 28 Aug, 2009

tipichris wrote:Here's the patch to spageedit.php that solved the issue for me

Code: Select all
--- lists/admin/spageedit.php.orig      Fri May 29 21:42:49 2009
+++ lists/admin/spageedit.php   Sun May 31 20:32:45 2009
@@ -54,9 +54,9 @@
   if (isset($_POST['attr_use']) && is_array($_POST['attr_use'])) {
     $cnt=0;
     while (list($att,$val) = each ($_POST['attr_use'])) {
-      $default = $attr_default[$att];
-      $order = $attr_listorder[$att];
-      $required = $attr_required[$att];
+      $default = $_POST['attr_default'][$att];
+      $order = $_POST['attr_listorder'][$att];
+      $required = $_POST['attr_required'][$att];

       Sql_Query(sprintf('insert into %s (id,name,data) values(%d,"attribute%03d","%s")',
         $tables["subscribepage_data"],$id,$att,
@@ -73,11 +73,11 @@
   }
   if (ENABLE_RSS) {
     Sql_Query(sprintf('replace into %s (id,name,data) values(%d,"rssintro","%s")',
-       $tables["subscribepage_data"],$id,$rssintro));
+       $tables["subscribepage_data"],$id,$_POST['rssintro']));
     Sql_Query(sprintf('replace into %s (id,name,data) values(%d,"rss","%s")',
-       $tables["subscribepage_data"],$id,join(',',$rss)));
+       $tables["subscribepage_data"],$id,join(',',$_POST['rss'])));
     Sql_Query(sprintf('replace into %s (id,name,data) values(%d,"rssdefault","%s")',
-       $tables["subscribepage_data"],$id,$rssdefault));
+       $tables["subscribepage_data"],$id,$_POST['rssdefault']));
   }
   if (!empty($_POST['activate'])) {
     Sql_Query(sprintf('update %s set active = 1 where id = %d',



See also: http://mantis.phplist.com/view.php?id=15285

The above fix by tipichris has been included in the patched lists/admin/spageedit.php file attached here:
Attachments
spageedit.zip
patched spageedit.php
Applied the fix suggested by tipichris
(3.67 KiB) Downloaded 1501 times
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Next

Return to Bug Discussion

Who is online

Users browsing this forum: No registered users and 2 guests