Viewing 13 replies - 1 through 13 (of 13 total)
  • Michael Beckwith

    (@tw2113)

    The BenchPresser

    Any issues with awarding achievements would have already been present, even before 4.0 was released, so the available update won’t have any effect.

    That said, more details on what’s going on with the awarding would help so we could start diagnosing.

    Thread Starter matt5834

    (@matt5834)

    Hi 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!
    Matt

    Thread Starter matt5834

    (@matt5834)

    I should add that if I award the achievement via the WP back end then it shows up fine on the users homepage.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    Line 43 mentioned above is $achievements = $achievements[$args['site_id']];

    Achievements variable is set with this line: $achievements = ( $earned_items = get_user_meta( absint( $args['user_id'] ), '_badgeos_achievements', true ) ) ? (array) $earned_items : array();

    So if you’re getting undefined offset, then line 43 is referring to a value in $achievements that doesn’t exist, at least for that user. Looks like it’s looking for index 69, aka a php array with 70 values stored in it, since arrays start at 0.

    Not sure if that’s going to be much help, but it’s what I can see without needing to log in.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    the biggest way I can see that snippet, that I drafted up, causing issues still is if it’s being originally run from a site that doesn’t have the same achievements in a different site. BadgeOS doesn’t excel at multisite because we used post types for our achievements instead of a custom table that stores everything and could be queried from anywhere uniformly.

    Thread Starter matt5834

    (@matt5834)

    Thanks 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
    Matt

    Thread Starter matt5834

    (@matt5834)

    Hi 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:3747

    Thread Starter matt5834

    (@matt5834)

    According 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/knights

    The 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
    Matt

    Thread Starter matt5834

    (@matt5834)

    One 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.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    I assume the first error_log() error is from this line:

    error_log($rs1);

    which would mean $rs1 is an array, like expected based on the future line of

    $step_id = $rs1[0]->lesson;

    Same array issue with $rs2, which you pass into error_log() twice.

    29846 is the achievement ID for the achievement that should be getting awarded to user 3747

    The biggest question is if 29846 is the correct and intended achievement on the knights subsite. I’m going to dare to assume Learndash has its own setup in each subsite, or is somehow able to share its lessons network wide.

    Why points are being awarded but not the achievement portion is something I do not have an answer for.

    Thread Starter matt5834

    (@matt5834)

    Each 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.

    Thread Starter matt5834

    (@matt5834)

    To 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.

    Michael Beckwith

    (@tw2113)

    The BenchPresser

    I’m honestly not sure at this point what’s going on with that. You have yourself a lot of data and it’s all live too, so not really easy to dissect and analyze to make sure it’s not an core issue/bug or something peculiar with a specific site.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘WP 4.0’ is closed to new replies.