-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid course module ID #34
Comments
Hi, thanks for the report. What is the page you are viewing? mod/customcert/view,php? |
View.php |
Thanks and no problem. So the error is happening because of https://github.com/markn86/moodle-mod_customcert/blob/master/view.php#L37 and unfortunately there is not much I can do in terms of code to fix this. It is basically saying that the module does not exist in the database (for whatever reason). Has this been a custom certificate you have been using before that no longer works, or one you just created? It would be great if I could get some replication steps. |
It's one we have been using. Did a update for Moodle and the certificate module over the weekend. Just had a user report it today though. |
When you say certificate module, do you mean mod_certificate or mod_customcert (you can tell by looking at the URL if it's mod/certificate/view.php or mod/customcert/view.php)? Either way I can't explain why the module would suddenly no longer exist on the site after an upgrade, yet still display in the course. Seems that something messed up somewhere. If a user has reported it, are you also able to reproduce it? |
Sorry about that, it is the customcert. Yes, as logged in as the administrator I get the invalid ID error as well. I also get the error when I attempt to download a previous certificate from another user. I'm not sure what happened either. :) I checked in the database and there seems to be the right information stored in the tables. Either way, I am restoring from a backup now, but I do have the "problem site" backed up so I can try and find a solution if it happens again. Although, if the same happens after I run git pull to update I will be back where I am...here's hoping. :) |
I have finished restoring the site and everything is working fine now. Before applying the updated mod_customcert, I tested it with another site of mine that is my testing site and determined it has something to do with the update process. I tested the viewing of a certificate before the update and was able to view it just fine, once I applied the update, I started getting the "Invalid course module ID". If you need anything or would like me to dump my "test" database, please let me know. Either way thank you for all that you do! :) |
Are you updating the customcert, or the Moodle version? If it's the customcert, what version are you upgrading from? |
I am updating the customcert and the version I'm updating from is Beta release (Build: 2016021900). |
Ok, so you would have installed from the release 43d20c0. This was before I was upgrading the database with any changes I made because it was still in beta, sorry. Are you able to turn on debugging mode (see https://docs.moodle.org/31/en/Debugging) to provide me with the full strack trace? |
The only DB change I performed since changing the plugin to Beta was the change to db/install.xml in 6889b04. If you have access to the 'customcert_pages' table can you confirm whether that there is a column 'sequence' there, and not 'pagenumber'? |
I knew I was taking a chance when using the beta version, I was just really loving how easy this module is to use to create a custom certificate. Thank you for taking the time with me! Here is the stack trace: |
No problem! It seems the grade element is pointing to a course module that no longer exists. If you edit customcert and then the grade element and re-select the grade item it displays the grade for then it should work as expected. Will have to fix it so the customcert doesn't explode when this happen. |
Alright, if I understand correctly, I should modify the certificate and change the grade for the course? Or do you mean something else? :) |
Nope. Just re-edit the custom certificate and edit the grade element you added to it, then under 'Grade item' select the grade item you want and then click on 'Save changes'. |
I never had a grade element added to the certificate. I did try and add one and selected the grade item as the course, although I am still getting the same error with the same stack trace. |
Ahh, nevermind. I looked at the the stack trace incorrectly. It is because the date element is using a function in the grade element that is trying to find a course module that does not exist. Ok, replace everything I said earlier with 'date' rather than 'grade'. |
Alright, it worked! You are awesome! I will update my module on my live site today, if all goes well, your solution will fix my problem there as well. I do have a question, when editing the element I noticed that the Position X and Y is no longer present. How do you reposition the elements? |
Glad I helped! :) You can drag and drop the elements by clicking on the 'Reposition elements' link under the list of elements. It should really be more noticeable. Will be addressing the UX experience in #35. |
Thank you! |
Reopening just to remind me to fix this when a course module is missing to avoid it exploding. :) |
I had the same problem on Moodle 3.0, and fixed it simply by editing the date element. Thanks. |
Fixed. |
When I click on get your custom certificate I get the following error Invalid course module ID.
Version: 3.1 release (Build: 2016052302)
The text was updated successfully, but these errors were encountered: