Changes to take care of forum upgrade to new roles system. Backed up forums

will also be converted to the new roles system if the backup was made
pre-roles.
This commit is contained in:
vyshane
2006-08-25 02:41:16 +00:00
parent 7f6301c464
commit e1b5643ff7
4 changed files with 275 additions and 188 deletions
+1
View File
@@ -65,6 +65,7 @@
//Start mod
fwrite ($bf,start_tag("MOD",3,true));
//Print forum data
fwrite ($bf,full_tag("ID",4,false,$forum->id));
fwrite ($bf,full_tag("MODTYPE",4,false,"forum"));
+12 -151
View File
@@ -231,168 +231,29 @@ function forum_upgrade($oldversion) {
if ($oldversion < 2006081800) {
// Upgrades for new roles and capabilities support.
require_once($CFG->dirroot.'/mod/forum/lib.php');
$forummod = get_record('modules', 'name', 'forum');
if ($forums = get_records('forum')) {
if (!$studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) {
error('No default student role found');
notice('Default student role was not found. Roles and permissions '.
'for all your forums will have to be manually set after '.
'this upgrade.');
}
if (!$guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) {
error('No default guest role found');
notice('Default guest role was not found. Roles and permissions '.
'for teacher forums will have to be manually set after '.
'this upgrade.');
}
foreach ($forums as $forum) {
if ($forum->type == 'teacher') {
// Teacher forums should be converted to normal forums that
// use the Roles System to implement the old behavior.
require_once($CFG->dirroot.'/course/lib.php');
if (count_records('forum_discussions', 'forum', $forum->id) == 0) {
// Delete empty teacher forums.
delete_records('forum', 'id', $forum->id);
} else {
// Create a course module for the forum and assign it to
// section 0 in the course.
$mod = new object;
$mod->course = $forum->course;
$mod->module = $forummod->id;
$mod->instance = $forum->id;
$mod->section = 0;
$mod->visible = 0;
$mod->visibleold = 0;
$mod->groupmode = 0;
if (!$cmid = add_course_module($mod)) {
error('Could not create new course module instance for the teacher forum');
} else {
$mod->coursemodule = $cmid;
if (!$sectionid = add_mod_to_section($mod)) {
error('Could not add converted teacher forum instance to section 0 in the course');
} else {
if (!set_field('course_modules', 'section', $sectionid, 'id', $cmid)) {
error('Could not update course module with section id');
}
}
}
// Change the forum type to general.
$forum->type = 'general';
if (!update_record('forum', $forum)) {
error('Could not change forum from type teacher to type general');
}
$context = get_context_instance(CONTEXT_MODULE, $cmid);
// Create overrides for default student and guest roles (prevent).
foreach($studentroles as $studentrole) {
assign_capability('mod/forum:viewforum', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:viewdiscussion', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:viewhiddentimedposts', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:startdiscussion', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:replypost', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:viewrating', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:viewanyrating', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:rate', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:createattachment', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:deleteownpost', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:deleteanypost', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:splitdiscussions', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:movediscussions', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:editanypost', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:viewqandawithoutposting', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:viewsubscribers', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:managesubscriptions', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:throttlingapplies', CAP_PREVENT, $studentrole->id, $context->id);
}
foreach($guestroles as $guestrole) {
assign_capability('mod/forum:viewforum', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:viewdiscussion', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:viewhiddentimedposts', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:startdiscussion', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:replypost', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:viewrating', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:viewanyrating', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:rate', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:createattachment', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:deleteownpost', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:deleteanypost', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:splitdiscussions', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:movediscussions', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:editanypost', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:viewqandawithoutposting', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:viewsubscribers', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:managesubscriptions', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:throttlingapplies', CAP_PREVENT, $guestrole->id, $context->id);
}
}
} else {
// Non-teacher forum.
if (!$cm = get_coursemodule_from_instance('forum', $forum->id)) {
error('Could not get the course module for the forum');
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
// $forum->open defines what students can do:
// 0 = No discussions, no replies
// 1 = No discussions, but replies are allowed
// 2 = Discussions and replies are allowed
switch ($forum->open) {
case 0:
foreach ($studentroles as $studentrole) {
assign_capability('mod/forum:startdiscussion', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:replypost', CAP_PREVENT, $studentrole->id, $context->id);
}
break;
case 1:
foreach ($studentroles as $studentrole) {
assign_capability('mod/forum:startdiscussion', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:replypost', CAP_ALLOW, $studentrole->id, $context->id);
}
break;
case 2:
foreach ($studentroles as $studentrole) {
assign_capability('mod/forum:startdiscussion', CAP_ALLOW, $studentrole->id, $context->id);
assign_capability('mod/forum:replypost', CAP_ALLOW, $studentrole->id, $context->id);
}
break;
}
// $forum->assessed defines whether forum rating is turned
// on (1 or 2) and who can rate posts:
// 1 = Everyone can rate posts
// 2 = Only teachers can rate posts
switch ($forum->assessed) {
case 1:
foreach ($studentroles as $studentrole) {
assign_capability('mod/forum:rate', CAP_ALLOW, $studentrole->id, $context->id);
}
// The legacy teacher role can already rate forum posts by default.
break;
case 2:
// The legacy student role cannot rate forum posts by default.
// The legacy teacher role can already rate forum posts by default.
break;
}
// $forum->assesspublic defines whether students can see
// everybody's ratings:
// 0 = Students can only see their own ratings
// 1 = Students can see everyone's ratings
switch ($forum->assesspublic) {
case 0:
// This is already the behavior of the default legacy roles.
break;
case 1:
assign_capability('mod/forum:viewanyrating', CAP_ALLOW, $studentrole->id, $context->id);
break;
}
if (!forum_convert_to_roles($forum, $forummod->id,
$studentroles, $guestroles)) {
notice('Forum with id '.$forum->id.' was not upgraded');
}
} // End foreach $forums.
}
// Drop column forum.open.
modify_database('', 'ALTER TABLE prefix_forum DROP COLUMN open;');
+206 -30
View File
@@ -1542,11 +1542,7 @@ function forum_subscribed_users($course, $forum, $groupid=0) {
}
if (forum_is_forcesubscribed($forum->id)) {
if ($forum->type == "teacher") {
return get_course_teachers($course->id); // Only teachers can be subscribed to teacher forums
} else {
return get_course_users($course->id); // Otherwise get everyone in the course
}
return get_course_users($course->id); // Otherwise get everyone in the course
}
return get_records_sql("SELECT u.id, u.username, u.firstname, u.lastname, u.maildisplay, u.mailformat, u.maildigest, u.emailstop,
u.email, u.city, u.country, u.lastaccess, u.lastlogin, u.picture, u.timezone, u.lang, u.trackforums
@@ -1604,30 +1600,28 @@ function forum_get_course_forum($courseid, $type) {
$forum->timemodified = time();
$forum->id = insert_record("forum", $forum);
if ($forum->type != "teacher") {
if (! $module = get_record("modules", "name", "forum")) {
notify("Could not find forum module!!");
return false;
}
$mod->course = $courseid;
$mod->module = $module->id;
$mod->instance = $forum->id;
$mod->section = 0;
if (! $mod->coursemodule = add_course_module($mod) ) { // assumes course/lib.php is loaded
notify("Could not add a new course module to the course '$course->fullname'");
return false;
}
if (! $sectionid = add_mod_to_section($mod) ) { // assumes course/lib.php is loaded
notify("Could not add the new course module to that section");
return false;
}
if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) {
notify("Could not update the course module with the correct section");
return false;
}
include_once("$CFG->dirroot/course/lib.php");
rebuild_course_cache($courseid);
if (! $module = get_record("modules", "name", "forum")) {
notify("Could not find forum module!!");
return false;
}
$mod->course = $courseid;
$mod->module = $module->id;
$mod->instance = $forum->id;
$mod->section = 0;
if (! $mod->coursemodule = add_course_module($mod) ) { // assumes course/lib.php is loaded
notify("Could not add a new course module to the course '$course->fullname'");
return false;
}
if (! $sectionid = add_mod_to_section($mod) ) { // assumes course/lib.php is loaded
notify("Could not add the new course module to that section");
return false;
}
if (! set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) {
notify("Could not update the course module with the correct section");
return false;
}
include_once("$CFG->dirroot/course/lib.php");
rebuild_course_cache($courseid);
return get_record("forum", "id", "$forum->id");
}
@@ -4109,8 +4103,8 @@ function forum_delete_userdata($data, $showfeedback=true) {
}
}
// Called by course/reset.php
// Called by course/reset.php
function forum_reset_course_form($course) {
echo get_string('resetforums', 'forum'); echo ':<br />';
print_checkbox('reset_forum_news', 1, true, get_string('namenews','forum'), '', ''); echo '<br />';
@@ -4120,4 +4114,186 @@ function forum_reset_course_form($course) {
print_checkbox('reset_forum_general', 1, true, get_string('generalforum','forum'), '', ''); echo '<br />';
}
?>
/**
* Converts a forum to use the Roles System
* @param $forum - a forum object with the same attributes as a record
* from the forum database table
* @param $forummodid - the id of the forum module, from the modules table
* @param $studentroles - array of roles that have the moodle/legacy:student
* capability
* @param $guestroles - array of roles that have the moodle/legacy:guest
* capability
* @param $cmid - the course_module id for this forum instance
* @return boolean - forum was converted or not
*/
function forum_convert_to_roles($forum, $forummodid, $studentroles=array(), $guestroles=array(), $cmid=NULL) {
global $CFG;
if (!isset($forum->open) && !isset($forum->assesspublic)) {
// We assume that this forum has already been converted to use the
// Roles System. Columns forum.open and forum.assesspublic get dropped
// once the forum module has been upgraded to use Roles.
return false;
}
if ($forum->type == 'teacher') {
// Teacher forums should be converted to normal forums that
// use the Roles System to implement the old behavior.
require_once($CFG->dirroot.'/course/lib.php');
if (count_records('forum_discussions', 'forum', $forum->id) == 0) {
// Delete empty teacher forums.
delete_records('forum', 'id', $forum->id);
} else {
// Create a course module for the forum and assign it to
// section 0 in the course.
$mod = new object;
$mod->course = $forum->course;
$mod->module = $forummodid;
$mod->instance = $forum->id;
$mod->section = 0;
$mod->visible = 0;
$mod->visibleold = 0;
$mod->groupmode = 0;
if (!$cmid = add_course_module($mod)) {
error('Could not create new course module instance for the teacher forum');
} else {
$mod->coursemodule = $cmid;
if (!$sectionid = add_mod_to_section($mod)) {
error('Could not add converted teacher forum instance to section 0 in the course');
} else {
if (!set_field('course_modules', 'section', $sectionid, 'id', $cmid)) {
error('Could not update course module with section id');
}
}
}
// Change the forum type to general.
$forum->type = 'general';
if (!update_record('forum', $forum)) {
error('Could not change forum from type teacher to type general');
}
$context = get_context_instance(CONTEXT_MODULE, $cmid);
// Create overrides for default student and guest roles (prevent).
foreach ($studentroles as $studentrole) {
assign_capability('mod/forum:viewforum', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:viewdiscussion', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:viewhiddentimedposts', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:startdiscussion', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:replypost', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:viewrating', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:viewanyrating', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:rate', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:createattachment', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:deleteownpost', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:deleteanypost', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:splitdiscussions', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:movediscussions', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:editanypost', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:viewqandawithoutposting', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:viewsubscribers', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:managesubscriptions', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:throttlingapplies', CAP_PREVENT, $studentrole->id, $context->id);
}
foreach ($guestroles as $guestrole) {
assign_capability('mod/forum:viewforum', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:viewdiscussion', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:viewhiddentimedposts', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:startdiscussion', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:replypost', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:viewrating', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:viewanyrating', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:rate', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:createattachment', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:deleteownpost', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:deleteanypost', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:splitdiscussions', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:movediscussions', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:editanypost', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:viewqandawithoutposting', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:viewsubscribers', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:managesubscriptions', CAP_PREVENT, $guestrole->id, $context->id);
assign_capability('mod/forum:throttlingapplies', CAP_PREVENT, $guestrole->id, $context->id);
}
}
} else {
// Non-teacher forum.
if (empty($cmid)) {
// We were not given the course_module id. Try to find it.
if (!$cm = get_coursemodule_from_instance('forum', $forum->id)) {
notice('Could not get the course module for the forum');
continue;
} else {
$cmid = $cm->id;
}
}
$context = get_context_instance(CONTEXT_MODULE, $cmid);
// $forum->open defines what students can do:
// 0 = No discussions, no replies
// 1 = No discussions, but replies are allowed
// 2 = Discussions and replies are allowed
switch ($forum->open) {
case 0:
foreach ($studentroles as $studentrole) {
assign_capability('mod/forum:startdiscussion', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:replypost', CAP_PREVENT, $studentrole->id, $context->id);
}
break;
case 1:
foreach ($studentroles as $studentrole) {
assign_capability('mod/forum:startdiscussion', CAP_PREVENT, $studentrole->id, $context->id);
assign_capability('mod/forum:replypost', CAP_ALLOW, $studentrole->id, $context->id);
}
break;
case 2:
foreach ($studentroles as $studentrole) {
assign_capability('mod/forum:startdiscussion', CAP_ALLOW, $studentrole->id, $context->id);
assign_capability('mod/forum:replypost', CAP_ALLOW, $studentrole->id, $context->id);
}
break;
}
// $forum->assessed defines whether forum rating is turned
// on (1 or 2) and who can rate posts:
// 1 = Everyone can rate posts
// 2 = Only teachers can rate posts
switch ($forum->assessed) {
case 1:
foreach ($studentroles as $studentrole) {
assign_capability('mod/forum:rate', CAP_ALLOW, $studentrole->id, $context->id);
}
// The legacy teacher role can already rate forum posts by default.
break;
case 2:
// The legacy student role cannot rate forum posts by default.
// The legacy teacher role can already rate forum posts by default.
break;
}
// $forum->assesspublic defines whether students can see
// everybody's ratings:
// 0 = Students can only see their own ratings
// 1 = Students can see everyone's ratings
switch ($forum->assesspublic) {
case 0:
// This is already the behavior of the default legacy roles.
break;
case 1:
assign_capability('mod/forum:viewanyrating', CAP_ALLOW, $studentrole->id, $context->id);
break;
}
}
return true;
}
?>
+56 -7
View File
@@ -33,7 +33,7 @@
//-----------------------------------------------------------
function forum_restore_mods($mod,$restore) {
global $CFG,$db;
$status = true;
@@ -53,6 +53,18 @@
$forum->type = backup_todb($info['MOD']['#']['TYPE']['0']['#']);
$forum->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
$forum->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
// These get dropped in Moodle 1.7 when the new Roles System gets
// set up. Therefore they might or not be there depending on whether
// we are restoring a 1.6+ forum or a 1.7 or later forum backup.
if (isset($info['MOD']['#']['OPEN']['0']['#'])) {
$forum->open = backup_todb($info['MOD']['#']['OPEN']['0']['#']);
}
if (isset($info['MOD']['#']['ASSESSPUBLIC']['0']['#'])) {
$forum->assesspublic = backup_todb($info['MOD']['#']['ASSESSPUBLIC']['0']['#']);
}
$forum->assessed = backup_todb($info['MOD']['#']['ASSESSED']['0']['#']);
$forum->assesstimestart = backup_todb($info['MOD']['#']['ASSESSTIMESTART']['0']['#']);
$forum->assesstimefinish = backup_todb($info['MOD']['#']['ASSESSTIMEFINISH']['0']['#']);
@@ -67,6 +79,7 @@
$forum->blockafter = backup_todb($info['MOD']['#']['BLOCKAFTER']['0']['#']);
$forum->blockperiod = backup_todb($info['MOD']['#']['BLOCKPERIOD']['0']['#']);
//We have to recode the scale field if it's <0 (positive is a grade, not a scale)
if ($forum->scale < 0) {
$scale = backup_getid($restore->backup_unique_code,"scale",abs($forum->scale));
@@ -74,9 +87,9 @@
$forum->scale = -($scale->new_id);
}
}
$newid = insert_record ('forum', $forum);
$newid = insert_record("forum", $forum);
//Do some output
if (!defined('RESTORE_SILENTLY')) {
@@ -88,6 +101,9 @@
//We have the newid, update backup_ids
backup_putid($restore->backup_unique_code,$mod->modtype,
$mod->id, $newid);
$forum->id = $newid;
//Now check if want to restore user data and do it.
if (restore_userdata_selected($restore,'forum',$mod->id)) {
//Restore forum_subscriptions
@@ -130,10 +146,34 @@
set_field ('forum_posts','mailed', '1', 'discussion', $sdid);
}
}
} else {
$status = false;
}
// If the backup contained $forum->open and $forum->assesspublic,
// we need to convert the forum to use Roles. It means the backup
// was made pre Moodle 1.7. We check the backup_version to make
// sure.
if ($restore->backup_version < 2006082300 &&
isset($forum->open) && isset($forum->assesspublic)) {
$forummod = get_record('modules', 'name', 'forum');
if (!$studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) {
notice('Default student role was not found. Roles and permissions '.
'for all your forums will have to be manually set.');
}
if (!$guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) {
notice('Default guest role was not found. Roles and permissions '.
'for teacher forums will have to be manually set.');
}
require_once($CFG->dirroot.'/mod/forum/lib.php');
forum_convert_to_roles($forum, $forummod->id,
$studentroles, $guestroles,
$restore->mods['forum']->instances[$mod->id]->restored_as_course_module);
}
} else {
$status = false;
}
@@ -149,7 +189,10 @@
$status = true;
//Get the discussions array
$subscriptions = $info['MOD']['#']['SUBSCRIPTIONS']['0']['#']['SUBSCRIPTION'];
$subscriptions = array();
if (isset($info['MOD']['#']['SUBSCRIPTIONS']['0']['#']['SUBSCRIPTION'])) {
$subscriptions = $info['MOD']['#']['SUBSCRIPTIONS']['0']['#']['SUBSCRIPTION'];
}
//Iterate over subscriptions
for($i = 0; $i < sizeof($subscriptions); $i++) {
@@ -307,7 +350,10 @@
$status = true;
//Get the read array
$readposts = $info['MOD']['#']['READPOSTS']['0']['#']['READ'];
$readposts = array();
if (isset($info['MOD']['#']['READPOSTS']['0']['#']['READ'])) {
$readposts = $info['MOD']['#']['READPOSTS']['0']['#']['READ'];
}
//Iterate over readposts
for($i = 0; $i < sizeof($readposts); $i++) {
@@ -548,7 +594,10 @@
$status = true;
//Get the ratings array
$ratings = $info['#']['RATINGS']['0']['#']['RATING'];
$ratings = array();
if (isset($info['#']['RATINGS']['0']['#']['RATING'])) {
$ratings = $info['#']['RATINGS']['0']['#']['RATING'];
}
//Iterate over ratings
for($i = 0; $i < sizeof($ratings); $i++) {