[solved] Improve attribute order in user findby and userdata

Solutions for other advanced phplisters

[solved] Improve attribute order in user findby and userdata

Postby Guest » 12:15pm, Thu 04 Sep, 2008

Hi all,

Having just got my install working I was wondering if anyone knew the answer to the following?

The findby drop down on the list of all users page which starts with Email and Foreign Key in the list. Can the order of this be defined by the listorder field in phplist_user_attribute table?

I don't think and order is defined within the sql for this within users.php?

I think the same is true for userdata which is used within the [notify] Change of List-Membership details email.

I've managed to fix the width of this drop down for longer attribute names by changing this in users.php in admin/commonlib/pages/

Originally as below, but have now changed 20 to 30
Code: Select all

Any help much appreciated, as this would neaten these couple of areas up.


Postby Ernesto » 6:40pm, Thu 04 Sep, 2008

Search first, Ask questions later...
PL Freak!
Posts: 592
Joined: 2:25am, Thu 08 Jun, 2006

Postby Guest » 11:39am, Fri 05 Sep, 2008

Hey thanks Ernesto,

I think my grey matter was feeling a bit rusty yesterday, taken a second look, after refreshing brain with the sql examples you provided. :D

:!: Fixed the sort order of the findby drop down selection field on the users page.

Sorry I forgot to take a copy of the code before I made this change but this is about 75 lines up from the bottom of users.php in admin/commonlib/pages/

Code: Select all
$att_req = Sql_Query("select id,name,listorder from ".$tables["attribute"]." where type = \"hidden\" or type = \"textline\" or type = \"select\" ORDER BY listorder ASC");

I've just snuck the following in;

added field name listorder into the select string of field names.

and between the last two ""

Code: Select all
ORDER BY listorder ASC

One thing that has also occurred to me and I don't want to seem like I'm teaching anyone to suck eggs, but in case anyone else new to coding finds this. I would suggest making a comment in the code so that if you upgrade you can find any mods such as this. Just incase you want to look at transferring them across (not that they will necessarily just transfer across as that will depend on what changes are in future releases, i.e. field names changed etc)

# Your Nickname/Initials August 2008, The lines below for this sql query have been
# modified to include the field listorder to set the order of values in the findby field
# on page users to ascending.


Just need to find where the sql is that feeds into the userdata block that's used in the [notify] Change of List-Membership details email, now, but imagine it will be similar to above.


:!: I'm using version 2.10.5

Postby Guest » 12:53pm, Tue 09 Sep, 2008

Hi All,

Following on from my previous message I have now found the code that produces the email confirmation to notify user of their details changing.

Firstly, the order of the userdata block, the following addition displays the attributes by listorder;

using subscribelib2.php in the admin folder, find the following line;

Code: Select all
$datachange .= "$strFrequency : ".$rssfrequency."\n";

A few lines below, there is a line which looks like the following, except I have added order by listorder to the end of this;

Code: Select all
$res = Sql_Query("select * from ".$GLOBALS["tables"]["attribute"] ." where id in ($attids) order by listorder");

I've then added the following leading spaces concatenation " " . (two spaces between quotes) to the following lines, also in this same .php file;

Code: Select all
$datachange .= "  " . "$strSendHTML : ";

Code: Select all
$datachange .= "  " . strip_tags($attribute["name"]) . " : ";

Have tested with receiving new message output in Outlook 2002 and Google Mail which now show a slightly neater format.

One thing I have noticed which I'm not sure whether it is meant to be or a bug is when a user updates their details via preferncesurl and they change their password. The admin notification email shows the password has been changed but it shows the dates that these were created rather than the passwords themselves? Not sure if this is true for others or whether I have introduced a bug in mine?


Re: [solved] Improve attribute order in user findby and userdata

Postby alxr » 2:11am, Sun 16 May, 2010

This is a top tip :-)

I don't know why the problem still exists even in 2.10.12.
Posts: 10
Joined: 8:36am, Thu 13 May, 2010

Return to Advanced Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 1 guest