cannod / moodle-drupalservices

Moodle plugin to connect to Drupal services
36 stars 25 forks source link

Mapping user fields from moodle to drupal table(s) #57

Closed goose2000 closed 9 years ago

goose2000 commented 9 years ago

Hi, not really an issue, more of support request - sorry. Do you know if you can use a MySQL view table to match the user fields (first, last, city etc.)? Does everything you try to match to, need to be in one table?

goose2000 commented 9 years ago

Answer is, no you can not. The plugin only looks to the Drupal's core 'fields' tables. But it would be nice alternative to look to a Drupal view to gather/map the user profile data. Just as the "User import/migration settings" already allow.

So I'd like to change this to a 'feature request' but can't figure how to do that.

netw3rker commented 9 years ago

If i remember correctly, the newest version pulls the fully loaded user object from Drupal and uses the object keys there to create field mappings. All the field mappings should be based on values associated with the user object. Basically speaking any data about a user that drupal knows about, the moodle plugin should also know about.

goose2000 commented 9 years ago

Yes, a user entity - so this should be a good way to go I see. Some of those field types like 'address' maybe a be tricky to drill down into, I had this going on for example:

(unfortunately I'm gonna need to open another ticked cause I'm stuck on the field mappings)

[field_ssw_address] => stdClass Object ( [und] => Array ( [0] => stdClass Object ( [country] => US [administrative_area] => NC [sub_administrative_area] => [locality] => Chapel Hill [dependent_locality] => [postal_code] => 27516 [thoroughfare] => 325 Pittsboro St. [premise] => [sub_premise] => [organisation_name] => UNC SSW BHRP [name_line] => [first_name] => [last_name] => [data] => )

            )

    )
netw3rker commented 9 years ago

Yeah, addresses and complex field types are a problem. I have some open work to create an iteration loop that will allow for deep variables to be selectable, but that's been sidelined for a while.