Closed (won't fix)
Project:
Site User List
Version:
4.7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
21 Apr 2007 at 11:38 UTC
Updated:
4 Aug 2017 at 19:20 UTC
Jump to comment: Most recent
Hi.
The new 4.7 version runs quite well on my setup now, and with finally seeing results, I can say thank you for such a wonderful module, I have been looking for something like this a long time.
But there's also one remaining issue:
Profile-Values are (mostly ?) stored serialized in the database in 4.7. This of course stays that way when your module gets those values into its own table. But unfortunately your module currently doesn't include an unserialize() - function... As far as I can tell it should be somewhere around row 600, but my PHP-knowledge and available time aren't up to this problem...
Comments
Comment #1
pukku commentedHi! What kind of profile.module fields are you referring to? Strictly speaking, this module right now will only work with profile.module fields, not arbitrary profile fields created by any other module. This is in part because MySQL doesn't have very good support for sub-selects, so in order to search, I need to have either a table or a view. Thus, everything that I can make accessible needs to be selectable with a SQL query, not processed through PHP.
That being said, someone privately sent me code that does grab and unserialize the 'data' field from the users table, but I'm not interested at this point in incorporating that code (this may change).
Ricky
Comment #2
oneoftwo commentedHi.
I'm just talking about simple text value fields created by the 4.7.6 profile.module. At least in my profile_values table every value is stored serialized...
Comment #3
pukku commentedOK, that's weird. When I do a
SELECT * FROM profile_values, the data in thevaluecolumn is not serialized, but just data. What kind of profile fields are these? Are they single-line textfields? Or multi-line textfields? Or something else?Comment #4
oneoftwo commentedYes, it's a single-line text-field. But I just checked some code, and apparently the modified profile.module I am using is causing the serialization of all data... I didn't know that it also changed this aspect of data storage... And since I used it that way from the start of my site on, I can't really easily change it...
Update: Okay, I found a solution... After some trial-and-error coding, I found a solution that should work with every kind of value, be it serialized or not... (I don't know how to do "real" patch files, so here goes)
Row ~ 580
$use_themeing = variable_get('site_user_list_theme_cells', 0);
while($contact = db_fetch_array($result)) {
+
+ //catch serialized values
+ foreach ($contact as $pfkey => $pfvalue) {
+ $pfvalue_un = unserialize($pfvalue);
+ if ($pfvalue_un) {
+ $contact[$pfkey] = $pfvalue_un;
+ }
+ }
+
// allow items to be themed; see http://drupal.org/node/135189
if ($use_themeing) {
Now I know this is not completely nice since this apparently makes an unnecessary copy of the array, but the alternative while(list()=each()) solution just didn't work...
You might consider adding this to the code to the module any way, since date-fields appear to be serialized even with an original profile.module...
Comment #5
pukku commentedHi! First, why do you have a "modified" profile.module — is this something that is common? Is this a change you made, or did you get it from somewhere else?
Second, I'll look at this. My one concern is that calling unserialize() for every value in the entire table, especially as you start to increase your number of users, might cause a big speed decrease. Perhaps I'll make it optional (like the use of theme functions).
Ricky
Comment #6
oneoftwo commentedHi,
I use the profile.module provided by jaxxed ( http://drupal.org/node/29901 ) which allows for multiple choice profile fields, with some further small modifications by myself (mainly incorporating Drupal version updates). I don't think it's a common profile-module-version, though (which I personally find hard to understand...).
And yeah, I guess it's probably not the most resource-saving way of handling data... But optionality is of course always a way, and even if you decide not to include it, then at least a possible solution can now be found here for those people that might need it ;)
Well, thanks again anyway for your support and of course your module.
Comment #7
oneoftwo commentedFollow up for those who might want to use my solution for serialized values:
I noticed that sorting fails with serialized values... A solution would be to replace
$sql .= tablesort_sql($display_header);with this:
Comment #8
oneoftwo commentedsorry (typo), the new block should of course be:
Comment #9
pukku commentedHi! I just uploaded a completely new version of site_user_list to cvs. This new version makes it possible, in theory, to handle things like this more easily. The right way to do this is to use hook_user to grab any changes to profile information, and store a "viewable" version in a shadow table. Then, the internal_sql query would grab from that table for columns that are serialized. I will be working on this at some point (I have to implement hook_user for a few other things anyway).
Also, the new version allows sorting to occur on different columns than display, which will solve the sorting issue you mentioned.
Comment #10
nancydruI am seeing this problem too. In my case, it's on a date field. The profile field definition specifies this is a date field, so it should be handled that way.
Also, check boxes are displaying as 0 or 1, rather than as a check mark, which would be preferable.
Comment #11
nancydruOh, I almost forgot to say, I'm seeing it on the 5.x version.
Comment #12
pukku commented