Course Info Not Updating (No. of Topics)

More
13 years 3 months ago #1 by Neilw
Found another little glitch. We have the code for showing the course info {joomdlecourse id=3} embedded in K2/Joomla articles, and it shows the course descrip, plus start, enroll dates, cost and number of topics.

However, we just changed the number of topics in one course from 18 to 15. But it did not change in Joomla/Joomdle in the article. I tried reloading the course in the Joomdle admin/shop section, and clearing the cache in the main Site Admin/Clear Cache, but that did not clear up the problem.

Ideas appreciated on how to resolve this.

[Moodle 2.4; Joomdle 09]

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #2 by Antonio Durán
Replied by Antonio Durán on topic Course Info Not Updating (No. of Topics)
I changed this recently, but can't remember why.
I tested, and it is clear it is not working fine.

I went back to old way, and it seems to work.
You will need to edit moodle/auth/joomdle/auth.php, function get_course_info

Add in the query "co.numsections", in the list of selected fields.

Then, comment out this block:
Code:
$params = array ($id); $query = "SELECT count(*) FROM {$CFG->prefix}course_sections WHERE course = ? and section != 0 and visible=1 "; $course_info['numsections'] = $DB->count_records_sql($query, $params);

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #3 by Neilw
Replied by Neilw on topic Course Info Not Updating (No. of Topics)
When I comment out that section, I am getting an error: XML-RPC Error (404): Unknown error. My version of that section is very slightly different (R09). Doesn't have the visible=1.
Code:
$params = array ($id); $query = "SELECT count(*) FROM {$CFG->prefix}course_sections WHERE course = ? and section != 0 "; $course_info['numsections'] = $DB->count_records_sql($query, $params);

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #4 by Antonio Durán
Replied by Antonio Durán on topic Course Info Not Updating (No. of Topics)
Yes, I added the visible one while testing this.

Did you add the field to the query?

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #5 by Neilw
Replied by Neilw on topic Course Info Not Updating (No. of Topics)
Yes, added the field, but still got the error.

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #6 by Neilw
Replied by Neilw on topic Course Info Not Updating (No. of Topics)
Added it right after the co.startdate

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #7 by Antonio Durán
Replied by Antonio Durán on topic Course Info Not Updating (No. of Topics)
Did you remember to add a "," in the previous line?

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #8 by Neilw
Replied by Neilw on topic Course Info Not Updating (No. of Topics)
yes, added the comma

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #9 by Antonio Durán
Replied by Antonio Durán on topic Course Info Not Updating (No. of Topics)
Then I don't know what is causing the 404 error :(

Please Log in or Create an account to join the conversation.

More
13 years 3 months ago #10 by Neilw
Replied by Neilw on topic Course Info Not Updating (No. of Topics)
If you have it working, can you send/attach your auth.php file and I will try that to see if there might be something wrong with mine? Can't imagine there is because when I change it back, it does not get an error (but does not get the right number of sections).

Please Log in or Create an account to join the conversation.