id of course which quiz belongs

marcis26
How to get course id which contain quiz belongs in quiz node? $quiz->og_group_ref['und'][0]['target_id'] Is this correct way to get course id in this style?
marcis26

For example how to get course

For example how to get course id from quiz which finished. For example get course id in which user is in.
James Aparicio

Hi marcis26,

Hi marcis26,

Yes, you should use the constant LANGUAGE_NONE instead of 'und'.  That should give you one of the courses the lesson is associated to. If you have the lessons associated with several you will find them the same way with an index diferent than 0.

You can always use field_get_items if you want.

https://api.drupal.org/api/drupal/modules%21field%21field.module/function/field_get_items/7.x

 

Best regards

marcis26

LANGUAGE_NONE how to use it

LANGUAGE_NONE how to use it in hook_quiz_finished ?
James Aparicio

Instead of

Instead of

 $quiz->og_group_ref['und'][0]['target_id']

 $quiz->og_group_ref[LANGUAGE_NONE][0]['target_id']

 

Best regards