Posted on: 11/19/04 07:31pm
By: rjrufo
I'm trying to hack a part of a plugin that does a database call, and then creates a drop down menu. I'm stumped, and if anyone has any ideas, I'd really appreciate it.
The code is as follows:
function loc_makeSelection ($uid)
{
global $_TABLES;
$retval = '';
$loc = loc_getAll ();
$grplist = loc_getGroups ($uid);
$name = array( $loc );
$location = '<option value=\"loc_select\">' . $name . '</option>';
$retval .= '<select name="loc_select">';
$retval .= $location;
$retval .= '</select>';
return $retval;
}
I now have a drop down menu that displays only "array". It seems to not be getting the value of $loc, but in another function, it works just fine. If you need the code to see where I'm getting $loc, I'll post it too.
Anyone have any ideas?
Hacking an existing plugin Help!
Posted on: 11/20/04 08:36am
By: Dirk
[QUOTE BY= rjrufo] I now have a drop down menu that displays only "array". [/QUOTE]
Which indicates that the variable you're trying to display is an array ... In which case you should loop over its contents, using foreach
.
bye, Dirk
Hacking an existing plugin Help!
Posted on: 11/20/04 01:57pm
By: rjrufo
I new there was something I was overlooking. Thanks, it works now.
Now, another question. I'm going to include the option list in the custom registration form. Where do I need to edit the code that saves the new user? Is it lib-custom.php? I have other custom fields that work, but I'm not sure if I can update the groups table the same way.
Is it possible?
Hacking an existing plugin Help!
Posted on: 11/20/04 06:35pm
By: rjrufo
Ok, I now have the option list in /custom/memberdetail.thtml, it displays like I want it too, but I'm still not sure how to add the new users choice into the group_assignments table. That part has always confused me. What I don't know is what the different fields are for in that table. I can figure out ug_uid - the user ID, and ug_grp_id - the group ID, but ug_main_grp_id baffles me.
Maybe if I understood how the whole group thing works, I might be able to figure out what I'm trying to do.
Anyone have any insight on the groups?