H5P myCRED Hook
-
Hi there,
I’d like to create a hook to award myCRED pts to a user based on if they’ve completed an activity w/ 100% accuracy. Anyone able to help me out?
Ref: https://mycred.me/tutorials/how-to-make-your-custom-hook/
Thanks!
Bob
-
@rpetitto No, that plugin is just an example of how other plugins can override stuff – it doesn’t do anything useful.
Hi rpetitto and icc0rz,
Many thanks for your great effort, I think this plugin has a great commercial potential given the rising interest in H5P especially in the large market of language learning.
I tried to get it working with no luck, I am wondering if I am missing something ?
On GitHub, there are two plugins, I tried both with no luck, Do I need to add an extra piece of code somewhere apart from only installing the plugin ?
1- https://github.com/rpetitto/mycred-h5p/
This one enables new settings in MyCred , after configuration, nothing gets added (checked MyCred logs)2- https://github.com/icc/mycred-h5p
New settings gets created in Mycred, it actually created points for H5P successfully but it happened only one time , If I redo the same content again it does not work.Do I need to add code as per this link : https://github.com/h5p/h5p-wordpress-plugin/commit/04c60c8a0c3f89127d296789f4c30843ba7e01b1
If yes then which of the two Github links you recommend ?
Many thanks in advance,
You do not need to add the code if you’re running the latest version of the H5P plugin, it’s already included.
I suggest using rpetitto/mycred-h5p as the icc/mycred-h5p is more of a starting shell for the plugin.
Remember to enable the H5P hook inside the mycred configuration.
Check your web server’s error_log file for any potential mishaps if it’s not working.You can temporarily add the following to your wp-config.php to enable more debugging and error messages:
define('WP_DEBUG', true); error_reporting(E_ERROR | E_WARNING | E_PARSE);
- This reply was modified 7 years, 5 months ago by icc0rz.
Many thanks for your answer icc0rz, I tried all the recommended steps but the issue still persist , no points in MyCred are given for H5P , I tried many H5P types (Multiple choice question, drag and drop and Question Set)
Any advice will be highly appreciated ?
The log file on the server gets many error lines like the following with each H5P action, many lines with each H5P action and all are the same
[Sun Jun 18 09:51:11.240749 2017] [proxy_fcgi:error] [pid 20647:tid 140493237036800] [client 35.189.195.120:36187] AH01071: Got error ‘PHP message: PHP Deprecated: Non-static method bphelp_remove_profile_links::remove_xprofile_links() sho$
[Sun Jun 18 09:51:11.271301 2017] [proxy_fcgi:error] [pid 8582:tid 140493472032512] [client 217.165.96.74:50763] AH01071: Got error ‘PHP message: PHP Deprecated: Non-static method bphelp_remove_profile_links::remove_xprofile_links() shoul$
[Sun Jun 18 09:52:09.965850 2017] [proxy_fcgi:error] [pid 20647:tid 140493320963840] [client 35.189.195.120:36197] AH01071: Got error ‘PHP message: PHP Deprecated: Non-static method bphelp_remove_profile_links::remove_xprofile_links() sho$
[Sun Jun 18 09:52:10.008455 2017] [proxy_fcgi:error] [pid 20647:tid 140493631493888] [client 35.189.195.120:36195] AH01071: Got error ‘PHP message: PHP Deprecated: Non-static method bphelp_remove_profile_links::remove_xprofile_links() sho$
[Sun Jun 18 09:52:10.067715 2017] [proxy_fcgi:error] [pid 20647:tid 140493673457408] [client 66.249.66.89:54907] AH01071: Got error ‘PHP message: PHP Deprecated: Non-static method bphelp_remove_profile_links::remove_xprofile_links() shoul$Strange…I’ll take a look at the code, but I tested this morning and it seems to be working as expected on my end.
Hi rpetitto & icc0rz,
Everything works great now after reinstalling the plugin.
After extensive testing I can say that the plugin works great.
Will be grateful about your answers on the following clarifications ?1- The plugin award points only when the user answer correctly, the issue with that is , most of H5P content is grouped into “Question Set” or “Presentation” components where 10 or more H5P questions are grouped into one, when the user answer all questions right and only one wrong then no points are awarded at all !!
As a solution , is it possible to award points for only trying any H5P component ?
2- I am struggling to understand what the plugin settings do ?
The filed named “Completing an H5P Activity” ?
And the check box “User gains %_plural equal to points earned in activity”Many thanks in advance
A small correction to my previuos comment, to point number 1
1- The plugin award points only when the user answer correctly on the first time , the issue with that is , most of H5P content is grouped into “Question Set” or “Presentation” components where 10 or more H5P questions are grouped into one, when the user answer all questions right and only one wrong then no points are awarded at all even if the user answer all questions right on the second time!!
Points are only awarded if all questions are answered correctly on the first time .
Any suggestions to fix that are highly appreciated .Thanks
Happy to donate/fund the discussed changes.
Thanks@samnajar, this is certainly doable by altering the code on lines 71-77 of mycredh5p.php. Let me know exactly how you want the plugin (points for attempt, partial points for number correct, able to retry for full points, etc.) to function and I’ll send you the altered code.
Many thanks rpetitto for your reply,
Being able to retry for full points and Partial points based on the number of correct questions answered should do the trick.In case testing is required, you may use this H5P quiz
https://h5p.org/node/91199I will make sure to mention your name for deserved credit on the website once it goes live.
Many thanks in advance
First of all, thank you for making this plugin! But I can’t seem to make it work. It’s installed (from https://github.com/rpetitto/mycred-h5p/) and I’ve added “myCRED H5P” to the Active Hooks. But completing H5P activity doesn’t seem to earn points (I checked that one of the built-in hooks adds points).
I tried deleting and reinstalling the hook plugin.
I’m not too sure how to check error logs but I did find this (although the date is not today):
“[24-Apr-2017 16:20:11 UTC] WordPress database error Table ‘.wrd_h5p_tmpfiles’ doesn’t exist for query ALTER TABLE wrd_h5p_tmpfiles ADD COLUMN id INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST, DROP PRIMARY KEY, ADD PRIMARY KEY(id) made by include(‘phar:///usr/local/bin/wp/php/boot-phar.php’), include(‘phar:///usr/local/bin/wp/php/wp-cli.php’), WP_CLI\Runner->start, WP_CLI\Runner->load_wordpress, require(‘wp-settings.php’), do_action(‘init’), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, H5P_Plugin::check_for_updates”
Any suggestions what to try next?
Thank you!
Hey there. Yeah that error must be an old one…I just updated the plugin to version .3 and added a couple options. Delete and reinstall to see if they work for you.
Thank you for the reply! I should have mentioned that I had version 0.3 with the “partial credit” option (just installed yesterday for the first time; not sure why that error log had an old date). I deleted and reinstalled 0.3 anyway, but still no sign of credit. Is there anything else I can try?
Hi @lin2ai4,
One of the tricky issues I faced which gave me the feeling that it does not work is … the hook actually work only one time if you get the all questions correct in the first time you ever test the H5P component…. otherwise no points will be given at all
Try creating a new H5P component and solve all question right in the first time.
I think @rpetitto is now working on a couple of changes to change that behaviuor.. for details please check the comments above.Hi @rpetitto ,
Just tested version 0.3, partial points works great but the ability to re-take the test is still not working.
Thanks
- The topic ‘H5P myCRED Hook’ is closed to new replies.