Only lists a few users

JordiTR - October 20, 2008 - 07:35
Project:User Info
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:danielskeenan
Status:needs work
Description

Hi and thanks for that module.

I've been trying it and it's a very practical module, curious to see that there's nothing else to easily list all the users and their profile fields anywhere (at least I haven't found it), for that reason I think that module is so important.

But at least on my site it only list the first 7 users and no more. I had a look at the code and it's no so long, quite simple and quite clear. I had a look at the data on my db tables and I can't see any data that could prevent listing the rest. Any idea?

#1

danielskeenan - October 21, 2008 - 00:00

That does seem a bit weired. Can you just double check that Drupal doesn't think you only have 7 users? You can check this in phpMyAdmin/phpPgAdmin or by using the SQL command SELECT * FROM `$TABLEPREFIX_users` where $TABLEPREFIX is the table prefix you chose when you installed Drupal.

#2

JordiTR - October 21, 2008 - 07:21

That SQL list all the users (31 by now)... I've been also looking at other tables as "users_data" or "sequences" and I see no reason.

#3

manojranaweera - November 12, 2008 - 08:44

I also have the same problem. Mine list about 50% of users (lot more than 7 users as stated by JordiTR). Unfortunately, I have no competency at present to play with php. I also love to have a CSV download button. Otherwise it is superb. Many thanks Manoj

manoj@ranaweera.name
+44 7769734491
skype: ranaweeram
www.nwstartup20.co.uk

#4

danielskeenan - November 13, 2008 - 02:36

I just looked at the code a bit. The only thing I can see that would limit the number of users displayed would be the number of rows returned by MySQL. If you have this issue, can you please post your MySQL configuration here? I'm thinking it might be an issue with the number of rows returned in a query. If you can query your server directly, please run the following query and count the number of rows returned.
SELECT * FROM `{users}`
If the number of rows returned is equal to the number of users shown, them it is a problem with the MySQL install. If not, then there's a big somewhere in the module (or Drupal itself, but that is unlikely).
As a stop gap until I can tackle this problem, you can execute the following query in phpMyAdmin or a command line tool to get all profile fields.

SELECT `name` , `uid` , `value`
FROM PREFIX_profile_fields
INNER JOIN PREFIX_profile_values ON PREFIX_profile_fields.fid = PREFIX_profile_values.fid

Replace PREFIX with your table prefix.
Drupal should not have a problem displaying standard user fields in the "Users" Admin area.

#5

JordiTR - November 13, 2008 - 16:03

No it can't be the number of results returned by MySQL because I've managed to manipulate the profile.module code to be able to give on the site/profile page the same table as your module and it does with any problem... well, the only problem is that I've heavely manipulated the core profile module :-)

So, it's not related with the number of results my MySQL is able to return, in fact my users table has by now "only" 134 users, but I expect having hundreds or even more.

On the other hand, I've checked the select you present on #4 and, well, it returns a real lot of lines but the point is that it's not returning the final table, but an intermediate result that then your code filters to put all that data inside an indexed array, which I suspect is the one not been properly addressed to the expected final table on you module.

Something that I discovered when I tried to put the drupal pager function on your two selects the resulting table has mismatched alignements, the data gets out of order.

Unfortunately I don't know enough on PHP programming to see what could be wrong on your code.

#6

danielskeenan - November 13, 2008 - 20:08

The module uses the number of rows in the users table to find the number of users (That was the best way to do it that I could find, unless you have a different thought - I'm all for it!) I'll have to look this over some more than.

#7

danielskeenan - December 14, 2008 - 00:04
Assigned to:Anonymous» danielskeenan

I figured out what the problem is! When you delete a user and create more, there is a uid gap. That gap is making the module think that there are no more users and stop processing them. I'm working on a fix now for this.

#8

danielskeenan - December 14, 2008 - 00:46

A bit more on this that I found with more investigating. If the number of rows in the users table is lower than the highest uid, it will only display users whose uids are less than or equal to that number. Here's an example:

  • 100 users are created (Not including user 1)
  • Users with uids 50-101 are deleted
  • 50 more users are created
  • Because there are now 102 rows, only users with uids 1-102 are looked at. The remaining users are ignored. This is beacuse of an (incorrect!) assumption I made that uids are contiguous. When users are deleted, Drupal does not refill those uids, it just adds onto the last one. Therefore, there is a permanent gap in the uids.

#9

danielskeenan - December 14, 2008 - 02:30

Can anyone having this problem please try the attached patch? I've tested it a bit on my end, but I'd like to see how it works in the Real World™.

#10

danielskeenan - December 14, 2008 - 02:32
Status:active» needs review

Oops - forgot to attach the file!

AttachmentSize
userinfo-323561-9.patch 5.4 KB

#11

danielskeenan - December 16, 2008 - 23:02

For those interested, I just created a separate issue for the CSV export thingie - #347930: Create a CSV export function. This seems to be a common theme among users, so I figured that this made sense.

#12

JordiTR - December 17, 2008 - 08:53

Thanks, I'll try to check it ASAP. The CSV export function is included or just planned?

#13

danielskeenan - December 17, 2008 - 11:40

The csv export function is planned and partially implemented. You can actually try the dev version of this module which includes this fix and the csv export function.

#14

JordiTR - December 19, 2008 - 13:52

Hi. I've tried the dev version and it works partially. Finally it lists all users (521 by now on my site), and the link to the CSV file works as expected, but:

  • it doesn't compliment the profile tables with their corresponding data, only one of them
  • there are some extra rows, 8 in fact, with no uid, no name and "blocked" as only information
  • the exported CSV file has not a proper name, just "csv", instead of "users.csv" (at least ;-)

Thanks for your effort.

#15

danielskeenan - December 19, 2008 - 17:54
Status:needs review» needs work

Hmmm. I'm willing to be that those 8 users are the same users that you deleted. I'll look into that. Can you post issues regarding the export function into #347930: Create a CSV export function from now on?

#16

JordiTR - December 21, 2008 - 13:22

I've deleted far more than 8 users until now. We got some complexities on the registering process and we have created many many test users that we deleted.

 
 

Drupal is a registered trademark of Dries Buytaert.