Open VHlede opened 9 years ago
Hi VHlede, this is technically an issue for the moodle_sso module on drupal.org. But... ok I'm just kidding, you are really in the right place this time :)
The simple answer is, it should be possible (and kind of was in the 1.x line), but isn't currently available just yet, and I need help with it!
The long answer is, currently the entire user object gets transmitted from Drupal to Moodle, so, assuming that the CiviCRM fields of a user load during a full user_load() in Drupal, the data for them is coming across, it's just not being used.
I'm trying to avoid writing a custom condition and pattern for every kind of data format a module/suite can create inside of the user object, so I was thinking I should just create/populate the dropdown with some kind of legible version of all the object/key data of the entire user object. The issue with this is how do you represent object data in a friendly way to a non-drupal person that looks like this: field_city[0]['und']->value field_address[und][0]->city['value'][0]
Some input into the variable selectors that could fill those drop downs or some help writing code that can traverse the user object tree and get the values would be really great for solving this problem.
Alternatively I could add another field setting that specifies using a custom service function (or endpoint) for user data, and that endpoint could be provided by views (as it used to be). You could then compose a view that provides civicrm fields, and the problem would be solved. The downside to that is that it is really hard to support all of the nuances of people learning (and breaking) views they create for this, and I'm not quite ready to introduce that level of detail and complexity to the issue queue here ;)
I'd like to get thoughts from others on which approach (or both) that they'd like to see.
Thanks Netw3rker,
And Happy New Year!
I thought to post this on moodle_sso module on drupal.org. But this topic is in my opinion equally related to Moodle as it is to Drupal. Since here we have much more posts, I thought it is better to post it here.
To answer your question, I like both approaches. However, in my opinion the one with views looks more flexible and generally speaking safer solution. It can work with any Drupal run CRM.
I agree, providing support for all of the nuances of people learning (and breaking) views may be challenging. But there are ways to address that. I will be very happy to help with testing, and I can create tutorials (test + images and video) and export views code users can use to create/import clone of a tested view.
Would that work?
Thanks!
Yeah I'm leaning towards doing both in order to solve this. It might make sense for really high user traffic sites to make the user object transfer smaller, and using views to do that might make the most sense. I think starting with step 1 of allowing users to explore the whole user object in the select boxes is a good enough start, then going with step 2 of allowing a view/service to be created as an alternate option.
If you turn debugging mode to "developer" in moodle you should then see an output at the top that says something like "here's the full user returned", and then a bunch of formatted code looking data. It'll be helpful to see what your civi-user looks like from a data standpoint. Could you post it here (please make sure there's not any sensitive information in it!!).
Also, yes, helping with testing and tutorials are a big help!
Hi Netw3rker,
Below is that I'm getting as admin (twice on the same page).
Service were reached, here's the logged in user:stdClass Object
(
[sessid] => fCs39u6rH6qEynZZeFyAOqmcGWk5VmdHmCm5yUNN1Zo
[session_name] => SESS66ea775aa05fdcbba37c8304a82333a2
[user] => stdClass Object
(
[uid] => 1
[name] => admin
[mail] => vjeko@mywebsite.net
[theme] =>
[signature] =>
[signature_format] => filtered_html
[created] => 1419794889
[access] => 1420400485
[login] => 1419908990
[status] => 1
[timezone] => America/Chicago
[language] =>
[picture] => 0
[init] => vjeko@mywebsite.net
[data] => stdClass Object
(
[ckeditor_default] => t
[ckeditor_show_toggle] => t
[ckeditor_width] => 100%
[ckeditor_lang] => en
[ckeditor_auto_lang] => t
[overlay] => 1
)
[vid] => 26
[ip] => 67.162.8.--
[sid] => fCs39u6rH6qEynZZeFyAOqmcGWk5VmdHmCm5yUNN1Zo
[ssid] =>
[hostname] => 67.162.8.--
[timestamp] => 1420400498
[cache] => 0
[session] => CiviCRM|a:29:{s:4:"ufID";s:1:"1";s:6:"userID";s:3:"202";s:8:"ufUniqID";s:15:"vjeko@mywebsite.net";s:16:"CRM_Utils_Recent";a:10:{i:0;a:11:{s:5:"title";s:75:"Thank you for your Pledge - Mr. Vjekoslav LastName Jr. (Pledge Acknowledgment)";s:3:"url";s:94:"/civicrm/activity?action=view&reset=1&id=634&atype=10&cid=202&context=home";s:2:"id";i:634;s:4:"type";s:8:"Activity";s:10:"contact_id";s:3:"202";s:11:"contactName";s:23:"Mr. Vjekoslav LastName Jr.";s:7:"subtype";N;s:9:"isDeleted";b:0;s:9:"image_url";N;s:8:"edit_url";s:100:"/civicrm/activity/add?action=update&reset=1&id=634&atype=10&cid=202&context=home";s:10:"delete_url";s:96:"/civicrm/activity?action=delete&reset=1&id=634&atype=10&cid=202&context=home";}i:1;a:11:{s:5:"title";s:55:"Mr. Vjekoslav LastName Jr. - (Pledged $ 100.00 - Donation)";s:3:"url";s:90:"/civicrm/contact/view/pledge?action=view&reset=1&id=4&cid=202&context=home";s:2:"id";i:4;s:4:"type";s:6:"Pledge";s:10:"contact_id";s:3:"202";s:11:"contactName";N;s:7:"subtype";N;s:9:"isDeleted";b:0;s:9:"image_url";N;s:8:"edit_url";s:92:"/civicrm/contact/view/pledge?action=update&reset=1&id=4&cid=202&context=home";s:10:"delete_url";s:92:"/civicrm/contact/view/pledge?action=delete&reset=1&id=4&cid=202&context=home";}i:2;a:11:{s:5:"title";s:49:"Mr. Vjekoslav LastName Jr. - ($ 200.00 - Event Fee)";s:3:"url";s:97:"/civicrm/contact/view/contribution?action=view&reset=1&id=98&cid=202&context=home";s:2:"id";i:98;s:4:"type";s:12:"Contribution";s:10:"contact_id";s:3:"202";s:11:"contactName";N;s:7:"subtype";N;s:9:"isDeleted";b:0;s:9:"image_url";N;s:8:"edit_url";s:99:"/civicrm/contact/view/contribution?action=update&reset=1&id=98&cid=202&context=home";s:10:"delete_url";s:99:"/civicrm/contact/view/contribution?action=delete&reset=1&id=98&cid=202&context=home";}i:3;a:11:{s:5:"title";s:59:"Mr. Vjekoslav LastName Jr. (Attendee - Fall Fundraiser Dinner)";s:3:"url";s:96:"/civicrm/contact/view/participant?action=view&reset=1&id=52&cid=202&context=home";s:2:"id";i:52;s:4:"type";s:11:"Participant";s:10:"contact_id";s:3:"202";s:11:"contactName";N;s:7:"subtype";N;s:9:"isDeleted";b:0;s:9:"image_url";N;s:8:"edit_url";s:98:"/civicrm/contact/view/participant?action=update&reset=1&id=52&cid=202&context=home";s:10:"delete_url";s:98:"/civicrm/contact/view/participant?action=delete&reset=1&id=52&cid=202&context=home";}i:4;a:11:{s:5:"title";s:23:"Mr. Vjekoslav LastName Jr.";s:3:"url";s:41:"/civicrm/contact/view?reset=1&cid=202";s:2:"id";s:3:"202";s:4:"type";s:10:"Individual";s:10:"contact_id";s:3:"202";s:11:"contactName";s:23:"Mr. Vjekoslav LastName Jr.";s:7:"subtype";s:7:"Staff";s:9:"isDeleted";b:0;s:9:"image_url";N;s:8:"edit_url";s:58:"/civicrm/contact/add?reset=1&action=update&cid=202";s:10:"delete_url";N;}i:5;a:11:{s:5:"title";s:57:"Dr. Vjekoslav LastName Jr. (Employee of My Current Employer)";s:3:"url";s:89:"/civicrm/contact/view/rel?action=view&reset=1&id=217&cid=202&context=home";s:2:"id";s:3:"217";s:4:"type";s:12:"Relationship";s:10:"contact_id";s:3:"202";s:11:"contactName";N;s:7:"subtype";N;s:9:"isDeleted";b:0;s:9:"image_url";N;s:8:"edit_url";s:105:"/civicrm/contact/view/rel?action=update&reset=1&id=217&cid=202&rtype=a_b&context=home";s:10:"delete_url";s:105:"/civicrm/contact/view/rel?action=delete&reset=1&id=217&cid=202&rtype=a_b&context=home";}i:6;a:11:{s:5:"title";s:51:"Dr. Vjekoslav LastName Jr. - ($ 1,500.00 - Event Fee)";s:3:"url";s:97:"/civicrm/contact/view/contribution?action=view&reset=1&id=97&cid=202&context=home";s:2:"id";i:97;s:4:"type";s:12:"Contribution";s:10:"contact_id";s:3:"202";s:11:"contactName";N;s:7:"subtype";N;s:9:"isDeleted";b:0;s:9:"image_url";N;s:8:"edit_url";s:99:"/civicrm/contact/view/contribution?action=update&reset=1&id=97&cid=202&context=home";s:10:"delete_url";s:99:"/civicrm/contact/view/contribution?action=delete&reset=1&id=97&cid=202&context=home";}i:7;a:11:{s:5:"title";s:76:"Dr. Vjekoslav LastName Jr. (Attendee - Rain-forest Cup Youth Soccer Tournament)";s:3:"url";s:96:"/civicrm/contact/view/participant?action=view&reset=1&id=51&cid=202&context=home";s:2:"id";i:51;s:4:"type";s:11:"Participant";s:10:"contact_id";s:3:"202";s:11:"contactName";N;s:7:"subtype";N;s:9:"isDeleted";b:0;s:9:"image_url";N;s:8:"edit_url";s:98:"/civicrm/contact/view/participant?action=update&reset=1&id=51&cid=202&context=home";s:10:"delete_url";s:98:"/civicrm/contact/view/participant?action=delete&reset=1&id=51&cid=202&context=home";}i:8;a:11:{s:5:"title";s:50:"Dr. Vjekoslav LastName Jr. - Membership Type: General";s:3:"url";s:95:"/civicrm/contact/view/membership?action=view&reset=1&id=31&cid=202&context=home";s:2:"id";i:31;s:4:"type";s:10:"Membership";s:10:"contact_id";s:3:"202";s:11:"contactName";N;s:7:"subtype";N;s:9:"isDeleted";b:0;s:9:"image_url";N;s:8:"edit_url";s:97:"/civicrm/contact/view/membership?action=update&reset=1&id=31&cid=202&context=home";s:10:"delete_url";s:97:"/civicrm/contact/view/membership?action=delete&reset=1&id=31&cid=202&context=home";}i:9;a:11:{s:5:"title";s:51:"Dr. Vjekoslav LastName Jr. - ($ 100.00 - Member Dues)";s:3:"url";s:97:"/civicrm/contact/view/contribution?action=view&reset=1&id=96&cid=202&context=home";s:2:"id";i:96;s:4:"type";s:12:"Contribution";s:10:"contact_id";s:3:"202";s:11:"contactName";N;s:7:"subtype";N;s:9:"isDeleted";b:0;s:9:"image_url";N;s:8:"edit_url";s:99:"/civicrm/contact/view/contribution?action=update&reset=1&id=96&cid=202&context=home";s:10:"delete_url";s:99:"/civicrm/contact/view/contribution?action=delete&reset=1&id=96&cid=202&context=home";}}s:8:"entryURL";s:102:"http://www.mytestwebsite.org/civicrm/contact/view/pledge?reset=1&action=add&cid=202&context=pledge";s:7:"authSrc";i:4;s:20:"defaultWysiwygEditor";s:1:"2";s:10:"lcMessages";s:5:"en_US";s:5:"timer";a:1:{s:21:"check_CRM_Utils_Check";i:1420399441;}s:12:"qfPrivateKey";s:64:"b9285766bb864126dd25de78a7937e433bae6c47329fe4ca6cbe0210df7d3165";s:11:"qfSessionID";s:43:"fCs39u6rH6qEynZZeFyAOqmcGWk5VmdHmCm5yUNN1Zo";s:25:"CRM_Profile_Form_Dynamic_";a:7:{s:3:"gid";s:1:"1";s:2:"id";i:202;s:8:"register";i:0;s:14:"skipPermission";i:1;s:5:"ctype";s:10:"Individual";s:11:"multiRecord";N;s:8:"recordId";N;}s:25:"CRM_Dashlet_Page_Activity";a:1:{s:7:"context";s:7:"dashlet";}s:7:"view.id";s:3:"202";s:23:"CRM_Contribute_Page_Tab";a:3:{s:6:"action";i:16;s:3:"cid";s:3:"202";s:7:"context";s:6:"search";}s:27:"CRM_Contribute_Form_Search_";a:19:{s:3:"cid";s:3:"202";s:4:"crid";N;s:7:"context";s:12:"contribution";s:5:"limit";i:50;s:14:"searchFormName";s:6:"Search";s:5:"force";i:0;s:10:"formValues";a:1:{s:10:"contact_id";s:3:"202";}s:11:"queryParams";a:1:{i:0;a:5:{i:0;s:10:"contact_id";i:1;s:1:"=";i:2;s:3:"202";i:3;i:0;i:4;i:0;}}s:7:"summary";a:1:{s:5:"total";a:3:{s:3:"avg";s:10:"$ 1,500.00";s:6:"amount";s:10:"$ 1,500.00";s:5:"count";i:1;}}s:13:"columnHeaders";a:8:{i:0;a:3:{s:4:"name";s:6:"Amount";s:4:"sort";s:12:"total_amount";s:9:"direction";i:4;}i:1;a:3:{s:4:"name";s:4:"Type";s:4:"sort";s:14:"financial_type";s:9:"direction";i:4;}i:2;a:3:{s:4:"name";s:6:"Source";s:4:"sort";s:19:"contribution_source";s:9:"direction";i:4;}i:3;a:3:{s:4:"name";s:8:"Received";s:4:"sort";s:12:"receive_date";s:9:"direction";i:2;}i:4;a:3:{s:4:"name";s:14:"Thank-you Sent";s:4:"sort";s:13:"thankyou_date";s:9:"direction";i:4;}i:5;a:3:{s:4:"name";s:6:"Status";s:4:"sort";s:19:"contribution_status";s:9:"direction";i:4;}i:6;a:3:{s:4:"name";s:7:"Premium";s:4:"sort";s:12:"product_name";s:9:"direction";i:4;}i:7;a:1:{s:4:"desc";s:7:"Actions";}}s:4:"rows";a:1:{i:0;a:24:{s:10:"contact_id";s:3:"202";s:15:"contribution_id";s:2:"95";s:12:"contact_type";s:161:"
";s:9:"sort_name";s:16:"myLastname, Vjekoslav";s:12:"amount_level";N;s:12:"total_amount";s:7:"1500.00";s:14:"financial_type";s:8:"Donation";s:19:"contribution_source";s:5:"Check";s:12:"receive_date";s:19:"2015-01-04 13:28:00";s:13:"thankyou_date";N;s:22:"contribution_status_id";s:1:"1";s:19:"contribution_status";s:9:"Completed";s:11:"cancel_date";N;s:12:"product_name";N;s:7:"is_test";s:1:"0";s:21:"contribution_recur_id";N;s:12:"receipt_date";N;s:8:"currency";s:3:"USD";s:24:"contribution_campaign_id";N;s:8:"campaign";N;s:11:"campaign_id";N;s:24:"contribution_status_name";s:9:"Completed";s:8:"checkbox";s:9:"mark_x_95";s:6:"action";s:686:"ViewEditDelete";}}s:8:"rowCount";s:1:"1";s:9:"rowsEmpty";b:0;s:4:"qill";a:1:{i:0;a:0:{}}s:6:"crmPID";i:1;s:6:"crmSID";i:1;s:16:"crmSortDirection";i:2;s:12:"crmSortOrder";s:17:"receive_date desc";s:11:"crmRowCount";i:50;}s:19:"CRM_Member_Page_Tab";a:3:{s:6:"action";i:16;s:3:"cid";s:3:"202";s:7:"context";s:6:"search";}s:34:"CRM_Contact_Page_View_GroupContact";a:2:{s:3:"cid";s:3:"202";s:6:"action";i:16;}s:25:"CRM_Contact_Page_View_Tag";a:2:{s:3:"cid";s:3:"202";s:6:"action";i:16;}s:11:"userContext";a:8:{i:0;s:26:"/civicrm/dashboard?reset=1";i:1;s:41:"/civicrm/contact/view?reset=1&cid=202";i:2;s:29:"/civicrm/event/search?force=1";i:3;s:83:"/civicrm/contact/view?reset=1&force=1&cid=202&selectedChild=participant";i:4;s:29:"/civicrm/event/search?force=1";i:5;s:30:"/civicrm/pledge/search?force=1";i:6;s:78:"/civicrm/contact/view?reset=1&force=1&cid=202&selectedChild=pledge";i:7;s:30:"/civicrm/pledge/search?force=1";}s:25:"CRM_Contact_Page_View_Log";a:2:{s:3:"cid";s:3:"202";s:6:"action";i:16;}s:21:"CRM_Profile_Page_View";a:2:{s:2:"id";s:3:"202";s:3:"gid";s:1:"7";}s:24:"CRM_Profile_Page_Dynamic";a:3:{s:11:"multiRecord";N;s:8:"recordId";N;s:9:"allFields";N;}s:29:"CRM_Contact_Page_View_Summary";a:6:{s:3:"key";s:37:"335677001aa009ad353b3df786a94656_4461";s:3:"cid";s:3:"202";s:6:"action";i:16;s:11:"contactType";s:10:"Individual";s:14:"contactSubtype";s:5:"Staff";s:13:"selectedChild";s:7:"summary";}s:18:"CRM_Event_Page_Tab";a:3:{s:6:"action";i:16;s:3:"cid";s:3:"202";s:7:"context";s:6:"search";}s:21:"CRM_Activity_Page_Tab";a:2:{s:3:"cid";s:3:"202";s:6:"action";i:16;}s:32:"CRM_Activity_Form_ActivityLinks_";a:3:{s:8:"entryURL";s:70:"http://www.mytestwebsite.org/civicrm/contact/view/activity?reset=1&cid=202";s:5:"qfKey";N;s:3:"cid";s:3:"202";}s:33:"CRM_Activity_Form_ActivityFilter_";a:3:{s:8:"entryURL";s:70:"http://www.mytestwebsite.org/civicrm/contact/view/activity?reset=1&cid=202";s:5:"qfKey";N;s:9:"contactId";s:3:"202";}s:19:"CRM_Pledge_Page_Tab";a:3:{s:6:"action";i:16;s:3:"cid";s:3:"202";s:7:"context";s:6:"search";}}_CRM_Profile_Form_Dynamic__container|a:4:{s:8:"defaults";a:0:{}s:9:"constants";a:0:{}s:6:"values";a:1:{s:7:"Dynamic";a:0:{}}s:5:"valid";a:1:{s:7:"Dynamic";N;}}batches|a:9:{i:18;b:1;i:19;b:1;i:20;b:1;i:21;b:1;i:22;b:1;i:23;b:1;i:24;b:1;i:25;b:1;i:26;b:1;}updates_remaining|a:0:{}ckeditor|a:2:{s:8:"Advanced";a:2:{s:13:"UserFilesPath";s:21:"/sites/default/files/";s:21:"UserFilesAbsolutePath";s:51:"/home/websiteFolder/public_html/sites/default/files/";}s:4:"Full";a:2:{s:13:"UserFilesPath";s:21:"/sites/default/files/";s:21:"UserFilesAbsolutePath";s:51:"/home/websiteFolder/public_html/sites/default/files/";}}imce_directory|s:2:"u1";node_overview_filter|a:1:{i:0;a:2:{i:0;s:6:"status";i:1;s:8:"status-1";}}_CRM_Activity_Form_ActivityLinks__container|a:4:{s:8:"defaults";a:0:{}s:9:"constants";a:0:{}s:6:"values";a:1:{s:13:"ActivityLinks";a:0:{}}s:5:"valid";a:1:{s:13:"ActivityLinks";N;}}_CRM_Contribute_Form_Search__container|a:4:{s:8:"defaults";a:0:{}s:9:"constants";a:0:{}s:6:"values";a:1:{s:6:"Search";a:0:{}}s:5:"valid";a:1:{s:6:"Search";N;}}_CRM_Activity_Form_ActivityFilter__container|a:4:{s:8:"defaults";a:0:{}s:9:"constants";a:0:{}s:6:"values";a:1:{s:14:"ActivityFilter";a:0:{}}s:5:"valid";a:1:{s:14:"ActivityFilter";N;}}
[roles] => stdClass Object
(
[2] => authenticated user
[3] => administrator
)
)
)
And I'm getting this:
here's the complete user:Array
(
[vid] => 26
[log] =>
[authorid] => 1
[name] => admin
[mail] => vjeko@LastName.net
[theme] =>
[signature] =>
[signature_format] => filtered_html
[status] => 1
[timezone] => America/Chicago
[language] =>
[picture] =>
[data] => stdClass Object
(
[ckeditor_default] => t
[ckeditor_show_toggle] => t
[ckeditor_width] => 100%
[ckeditor_lang] => en
[ckeditor_auto_lang] => t
[overlay] => 1
)
[ip] => 67.162.8.75
[uid] => 1
[created] => 1419794889
[access] => 1420400485
[login] => 1419908990
[init] => vjeko@LastName.net
[revision_timestamp] => 1420399431
[revision_uid] => 1
[roles] => stdClass Object
(
[2] => authenticated user
[3] => administrator
)
[field_map_firstname] => stdClass Object
(
[und] => Array
(
[0] => stdClass Object
(
[value] => Admin
[format] =>
[safe_value] => Admin
)
)
)
[field_map_lastname] => stdClass Object
(
[und] => Array
(
[0] => stdClass Object
(
[value] => Admin
[format] =>
[safe_value] => Admin
)
)
)
[field_map_email] => stdClass Object
(
[und] => Array
(
[0] => stdClass Object
(
[value] => Amin
[format] =>
[safe_value] => Amin
)
)
)
[field_map_country] => stdClass Object
(
[und] => Array
(
[0] => stdClass Object
(
[value] => Us
[format] =>
[safe_value] => Us
)
)
)
[field_map_city] => stdClass Object
(
[und] => Array
(
[0] => stdClass Object
(
[value] => Chicago
[format] =>
[safe_value] => Chicago
)
)
)
[rdf_mapping] => stdClass Object
(
[rdftype] => Array
(
[0] => sioc:UserAccount
)
[name] => stdClass Object
(
[predicates] => Array
(
[0] => foaf:name
)
)
[homepage] => stdClass Object
(
[predicates] => Array
(
[0] => foaf:page
)
[type] => rel
)
)
[display_name] => Mr. Vjekoslav LastName Jr.
[sort_name] => LastName, Vjekoslav
[contact_id] => 202
[realname] => Vjekoslav LastName
[twitter_accounts] => Array
(
[0] => stdClass Object
(
[id] => 27113151
[screen_name] => vLastName
[name] => Vjekoslav LastName
[location] => Chicago, USA
[description] => Educational technologist | Moodler | Senior LMS Specialist
[followers_count] => 55
[friends_count] => 67
[statuses_count] => 47
[favourites_count] => 3
[url] => http://t.co/wnLqjdTF0N
[protected] => 0
[profile_image_url] => http://pbs.twimg.com/profile_images/112373185/vjeko80px2007_normal.jpg
[profile_background_color] => C0DEED
[profile_text_color] => 333333
[profile_link_color] => 0084B4
[profile_sidebar_fill_color] => DDEEF6
[profile_sidebar_border_color] => C0DEED
[profile_background_image_url] => http://abs.twimg.com/images/themes/theme1/bg.png
[profile_background_tile] => 0
[verified] => 0
[created_at] => Fri Mar 27 22:21:39 +0000 2009
[created_time] => 1238192499
[utc_offset] => -25200
[status] =>
[uid] => 1
[import] => 1
[mentions] => 1
[is_global] => 0
)
)
[revision] => 1
)
Hope that helps.
Vjeko
Hi, just wondering if there's been any progress on this, or if I can be of any help.
Recently I worked in this area where on Event registration a drupal user got created/updated and as per SSO. Moodle user got created/updated and on basis of Civi profile fields Here's my civi extension https://github.com/JMAConsulting/biz.jmaconsulting.civimoodle which works well with Drupal-Moodle SSO
Hi all, This is a great module. So far it works quite good. What I'm curious is - is it possible to use CiviCRM fields instead of creating those fields in Drupal? CiviCRM (a Drupal module) contains all needed fields: firstname, lastname,city, country etc. How can I send that to Moodle? Moodle + Drupal is a great combination. If we can add CiviCRM to that mix, that would be a solution for almost anything we need (a dream come true:). Please advise, Vjeko