Support » Plugin: Interactive Content – H5P » H5P myCRED Hook

Viewing 15 replies - 16 through 30 (of 50 total)
  • Just forked the plugin to include preferences to customize the value awarded per activity!


    @rpetitto, thanks for the updated code. Just wanted to let you and anyone reading this in the future, I got the following error message when using your code.

    ( ! ) Strict standards: Declaration of myCRED_Hook_H5P::sanitise_preferences() should be compatible with myCRED_Hook::sanitise_preferences($data) in E:\wordpress-development\localhost\\wp-content\plugins\mycred-h5p-master\mycredh5p.php on line 49

    To fix the issue, I replaced your code between lines 120 – 122 with the following:

    	 * Sanitize Preferences
    	public function sanitise_preferences( $data ) {
    		$new_data = $data;
    		// Apply defaults if any field is left empty
    		$new_data['creds'] = ( !empty( $data['creds'] ) ) ? $data['creds'] : $this->defaults['creds'];
    		$new_data['log'] = ( !empty( $data['log'] ) ) ? sanitize_text_field( $data['log'] ) : $this->defaults['log'];
    		return $new_data;

    If we can confirm that the code is bug free, you or @icc0rz should submit it to myCred for listing on their website. Gabriel is a good guy with a very useful plugin and I think this could be helpful to many others in the future.

    Phenomenal! Thanks for the revision. I’d love to see if we could even work it so we can assign different point values for different activities OR different point values for different criteria (dynamic points based on total points of activity, points for 100%, negative points for failed activities, etc.)


    @rpetitto, I like the idea. You would need hooks/action triggers from H5P to be able to get myCred to do what you suggest. We may need to lean on icc0rz expertise with this plugin to do that.

    @mobetman2, I just updated the plugin. Added option to award myCRED equal to points earned in the activity!!!

    Can you check to see if it works for your site?

    Thanks for all the work on this.

    My pleasure, @iroller! It’s been fun learning how to make custom myCRED plugins. Are there other features you’d like the plugin to have?

    I can’t think of anything at the moment. There is one small thing that is confusing to me however. The tick doesn’t stay beside User gains %_plural equal to points earned in activity after save is clicked and the points remain beside Completing an H5P Activity Therefore I wasn’t sure which was chosen. It would help if the option that isn’t being used was less visible if that makes sense. Anyway now I understand the way it works it is not a big problem. Our website is for children and they can get myCRED “stars” through a range of interactions which they can trade in for rewards in a Woocommerce shop. It will be great to be able to include the H5P range of quizzes with the bonus of myCRED points. Thanks again.

    @iroller. I’ll take a look. Mind sharing the URL your website for inspiration?

    I will set you up on the site and send you on the link – if my Google search has provided the correct contact details.

    @rpetitto, just got a chance to test the new plugin. It’s not working and I got the following errors:

    1. Code is displaying in the admin section. See screenshot
    2. Received debug error msg
    "Notice: Undefined variable: h5p_block in E:\wordpress-development\localhost\\wp-content\plugins\mycred-h5p-master\mycredh5p.php on line 112"

    I found the error…had a misplaced php closing tag. Please redownload/install to see if it fixes the issue.

    @rpetitto, the error is fixed but the plugin is not registering any points with myCred.

    Plugin Author icc0rz


    @mobetman2 Make sure you’ve upgraded to the latest H5P plugin, it should include the fix you previously had to apply. Also, make sure you activate the myCRED hook from the ‘Points’ menu.

    I was going to say the same thing as @icc0rz.

    icc0rz…does the h5pmod plugin need to be installed?

Viewing 15 replies - 16 through 30 (of 50 total)
  • The topic ‘H5P myCRED Hook’ is closed to new replies.