Welcome to Geeklog, Anonymous Monday, November 25 2024 @ 04:42 am EST

Geeklog Forums

Hacking an existing plugin... Help!


Status: offline

rjrufo

Forum User
Regular Poster
Registered: 06/14/03
Posts: 95
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:

Text Formatted Code


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?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by rjrufo: I now have a drop down menu that displays only "array".

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
 Quote

Status: offline

rjrufo

Forum User
Regular Poster
Registered: 06/14/03
Posts: 95
Doh! - that was a mistake 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?
 Quote

Status: offline

rjrufo

Forum User
Regular Poster
Registered: 06/14/03
Posts: 95
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?
 Quote

All times are EST. The time is now 04:42 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content