matt5834
Forum Replies Created
-
Forum: Plugins
In reply to: [BadgeOS] WP 4.0To clarify, their are identical LD lessons in each sub site all with identical ID’s in each sub site. So site “X” might have LD lesson “dog” with ID 123456, site “Y” has LD lesson “dog” with ID 123456.
Same with the BadgeOS achievements.Forum: Plugins
In reply to: [BadgeOS] WP 4.0Each sub site has it’s own LD lesson and the lesson ID’s are exactly the same.
Same with the Achievements. Each sub site has its own but the ID numbers are all the same on each sub site.
Yes, 29846 is the correct and intended achievement.
Forum: Plugins
In reply to: [BadgeOS] WP 4.0One more piece of info:
If I create a new achievement in the “knights” sub site and assign it to be awarded on LD lesson complete that is marked complete via Grassblade activity I get the same result.
The badge is not awarded but the points are.Forum: Plugins
In reply to: [BadgeOS] WP 4.0According to the last line it seems as though the badge is being awarded, SO, just to make clear the issue I’m having:
The badge is awarded on the sub site yciw.net/bs but not on the sub site yciw.net/knightsThe knights sub site is the one that the user completed the GB activity and the one that needs to reflect the badge. (the points are being awarded)
Given this. Can you think of a work around?
Thanks
MattForum: Plugins
In reply to: [BadgeOS] WP 4.0Hi Michael-
I uncommented the error_log from the plugin and this is what came back in the error log. Does it shed any light on what might be happening?
[25-Sep-2014 10:10:08 UTC] 29801:3747
[25-Sep-2014 10:10:08 UTC] SELECT post_id as lesson FROM wp_46_postmeta WHERE meta_key = ‘_badgeos_learndash_object_id’ AND meta_value = 29801
[25-Sep-2014 10:10:08 UTC] PHP Warning: error_log() expects parameter 1 to be string, array given in /home/yciwnet/public_html/wp-content/plugins/BadgesGrassbladeLearndash/ap-badgeos-grassblade-learndash.php on line 21
[25-Sep-2014 10:10:08 UTC] 29847
[25-Sep-2014 10:10:08 UTC] SELECT DISTINCT p2p_to as achievement_id FROM wp_46_p2p WHERE p2p_from = 29847
[25-Sep-2014 10:10:08 UTC] PHP Warning: error_log() expects parameter 1 to be string, array given in /home/yciwnet/public_html/wp-content/plugins/BadgesGrassbladeLearndash/ap-badgeos-grassblade-learndash.php on line 30
[25-Sep-2014 10:10:08 UTC] PHP Warning: error_log() expects parameter 1 to be string, array given in /home/yciwnet/public_html/wp-content/plugins/BadgesGrassbladeLearndash/ap-badgeos-grassblade-learndash.php on line 34
[25-Sep-2014 10:10:08 UTC] badgeos_maybe_award_achievement_to_user: 29846:3747Forum: Plugins
In reply to: [BadgeOS] WP 4.0Thanks Michael.
Just to clarify, it is being run on the same site that has the same achievements. Given that, do you think it is still a problem?thanks
MattForum: Plugins
In reply to: [BadgeOS] WP 4.0I should add that if I award the achievement via the WP back end then it shows up fine on the users homepage.
Forum: Plugins
In reply to: [BadgeOS] WP 4.0Hi Michael-
It’s in relation to this plugin https://pastebin.com/ieXYGFji
that allows Grassblade content to award Badges.The problem is this. On one site in my multisite network: yciw.net/bs everything works perfectly fine. On another site: yciw.net/knights the points are awarded but the badge is not. In the WP backend no achievement has been awarded and also in BadgeOS reports no achievement is awarded.
When in debug mode I see this error:
Notice: Undefined offset: 69 in /home/yciwnet/public_html/wp-content/plugins/badgeos/includes/user.php on line 43
class=”post-29019 page type-page status-publish hentry user-has-not-earned no-post-thumbnail”>There is indeed a thumbnail for the badge. It was copied from yciw.net/bs when yciw.net/knights was generated.
Does this error mean anything to you?
I think you have all of my log in info in an email if you’d like to check it out.
If not I’ll resend.Thank you!
MattForum: Plugins
In reply to: [BadgeOS LearnDash Add-on] Grassblade and Learndash Add-OnAlso, believe it or not I can’t find your email anywhere. I have only “no-reply” responses.
Forum: Plugins
In reply to: [BadgeOS LearnDash Add-on] Grassblade and Learndash Add-OnBefore we go any further I need to ask this: Is the plugin designed to take into account one particular Achievement ID and one particular Lesson ID? I can’t find in the code where those id’s would be. When you say “assuming we have the right lesson ID that is tied to the BadgeOS achievement in question”…..what do you think they are? I tried to ask this earlier so sorry if I wasn’t clear.
So for example, the badge ID would be: 29846
The lesson ID would be: 29801
Do these numbers need to go into the code somewhere??
Forum: Plugins
In reply to: [BadgeOS LearnDash Add-on] Grassblade and Learndash Add-OnAlso, Michael- Grassblade has quoted me a very reasonable rate to try and debug the plugin. Should I go ahead with that or do you think you’re close?
Thank you so much!
MattForum: Plugins
In reply to: [BadgeOS LearnDash Add-on] Grassblade and Learndash Add-OnSure no problem.
Go to:
https://www.yciw.net/bs/lessons/sequences-in-jazz-2/ (this one has the easiest answers)
I’ve created a user name for you. Login with: mbeckwith PW: welcome
Other lessons that use Grassblade are:
https://www.yciw.net/bs/lessons/sequences-and-scales-2/
https://www.yciw.net/bs/lessons/consonance-and-dissonance-lesson/
https://www.yciw.net/bs/lessons/3-note-harmonies/Let me know if you need any other info.
Thank you!
MattForum: Plugins
In reply to: [BadgeOS LearnDash Add-on] Grassblade and Learndash Add-OnMichael-
Thank you so much for your efforts. Unfortunately it is not working for me. I installed the plugin and tried 3 different lesson with Grassblade content. The Lesson is marked complete but the associated badge is not awarded. I have the badge setting set to “Complete Steps” and the step is a Learndash Lesson being completed.Did I need to change anything in the plugin as far as entering any lesson ID numbers?
Thanks again and let me know what else I can try.
Matt
Forum: Plugins
In reply to: [BadgeOS LearnDash Add-on] Grassblade and Learndash Add-OnHi Michael-
I tried the code but it did not award any achievements. Two things:
1. Could you say if I have the plugin formatted correctly. I am no PHP expert.2. Also, I’d be happy to hard code in the Lesson ID’s if that would make it guaranteed to work.
Here is my code:
[ Moderator note: Code fixed, please wrap code in backticks or use the code button. ]
<?php /* Plugin Name: Fix Grassblade Mark Complete for BadgeOS Plugin URI: Description: Processes BadgeOS Badges on Grassblade Mark Complete functions Version: 0.1 Author: Matt McLean Author URI: License: GPLv2 */ function ap_badge_award_grassblade($data) { //This is the bit I got from Pankaj: add_action("learndash_lesson_completed", function ($data) { $lesson_id = $data["lesson"]->ID; $user_id = $data["user"]->ID; //Required BadgeOS Code Here global $wpdb; $sql = "SELECT post_id as lesson FROM " . $wpdb->postmeta . " WHERE meta_key = %s AND meta_value = %d"; $rs1 = $wpdb->get_results( $wpdb->prepare( $sql, '_badgeos_learndash_object_id', $lesson_id ) ); if ( !empty( $rs1 ) ) { //Only need one of the "steps" to get the appropriate achievement ID later. $step_id = $rs1[0]->lesson; } $sql = "SELECT DISTINCT p2p_to as achievement_id FROM " . $wpdb->prefix . "p2p WHERE p2p_from = %d"; $rs2 = $wpdb->get_results( $wpdb->prepare( $sql, $step_id ) ); if ( !empty( $rs2 ) ) { //We'll have our achievement ID! $achievement_id = $rs2[0]->achievement_id; } if ( !empty( $achievement_id ) ) { badgeos_maybe_award_achievement_to_user( $achievement_id, $user_id ); } Here is the response from the BadgeOS Developer: "Well, from the looks of it, you have the user ID already, which is good. The question is where can we get the achievement ID necessary to award. It looks like you'll have the lesson ID that we can work with. Try out the code below. Best way I could think of offhand to get the achievement ID based on lesson ID. global $wpdb; $sql = "SELECT post_id as lesson FROM " . $wpdb->postmeta . " WHERE meta_key = %s AND meta_value = %d"; $rs1 = $wpdb->get_results( $wpdb->prepare( $sql, '_badgeos_learndash_object_id', $lesson_id ) ); if ( !empty( $rs1 ) ) { //Only need one of the "steps" to get the appropriate achievement ID later. $step_id = $rs1[0]->lesson; } $sql = "SELECT DISTINCT p2p_to as achievement_id FROM " . $wpdb->prefix . "p2p WHERE p2p_from = %d"; $rs2 = $wpdb->get_results( $wpdb->prepare( $sql, $step_id ) ); if ( !empty( $rs2 ) ) { //We'll have our achievement ID! $achievement_id = $rs2[0]->achievement_id; } if ( !empty( $achievement_id ) ) { badgeos_maybe_award_achievement_to_user( $achievement_id, $user_id ); }
Forum: Plugins
In reply to: [BadgeOS LearnDash Add-on] Grassblade and Learndash Add-OnHi Michael-
Yes I need the achievement warded with the associated points.Does this all make sense ok?
Matt