• Resolved blaagrrrl

    (@blaagrrrl)


    Hi,

    I had eight open badges set up on my WordPress install and everything worked fine a couple of weeks ago. But now if I manually assign a badge, it doesn’t show up under “Earned Achievements” in the user’s profile. However, a baked badge is saved in /uploads/user_badges/[user_id]/ but the entity ID is always 0. For example: Badge-0-248.png, Badge-0-1430.png.
    Do I need to reset the auto increment in the database? Is this the reason they don’t show up under “Earned Achievements”? Was this caused by an update?

    Anything will help.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter blaagrrrl

    (@blaagrrrl)

    I was able to pin the problem to line 205 in badgeos/includes/user.php:

    $wpdb->insert( $table_name, array(
    'ID' => $new_achievement->ID,
    'post_type' =>; $new_achievement->post_type,
    'achievement_title' => get_the_title( $new_achievement->ID ),
    'points' => $new_achievement->points,
    'point_type' => $new_achievement->point_type,
    'this_trigger' => $new_achievement->trigger,
    'user_id' => absint( $args['user_id'] ),
    'site_id' => $args['site_id'],
    'image' => $new_achievement->image,
    'rec_type' => $rec_type,
    'actual_date_earned' => badgeos_default_datetime( 'mysql_achievements' ),
    'date_earned' => current_time( 'mysql' )
    ));

    WordPress database error: [Unknown column 'actual_date_earned' in 'field list']

    I looked at the wp_badgeos_achievements table and there is no ‘actual_date_earned’ column, but a ‘date_earned’ column.

    I have badgeos version 3.6.6 installed.

    Are you going to patch this?

    • This reply was modified 4 years, 4 months ago by blaagrrrl.
    • This reply was modified 4 years, 4 months ago by blaagrrrl.
    • This reply was modified 4 years, 4 months ago by blaagrrrl.
    • This reply was modified 4 years, 4 months ago by blaagrrrl.
    • This reply was modified 4 years, 4 months ago by blaagrrrl.
    Plugin Author learningtimes

    (@learningtimes)

    Hi @blaagrrrl,

    Thanks for reaching out to us. It seems like the update isn’t running correctly. The column ” actual_date_earned” should have been added in the update process automatically. Could you please try to deactivate and activate the plugin again to see if this will resolve the issue?

    Thanks

    Thread Starter blaagrrrl

    (@blaagrrrl)

    I disabled and enabled the Badgeos and BadgeOS Community Add-On plugins and the problem persists.
    Can you please verify on which date the database table should have been updated. Were the changes applied during BadgeOS 3.6.6 update on Oct.2?

    Badgeos (3.6.6)
    BadgeOS Community Add-On (1.2.10)
    WordPress (5.5.1)

    Thread Starter blaagrrrl

    (@blaagrrrl)

    I still haven’t found a way to fix this issue. I tried to add a “actual_date_earned” column with type TIMESTAMP CURRENT_TIMESTAMP manually, but get an error because of the existing “date_earned” column:

    #1293 - Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause

    So, can I rename the “date_earned” column to “actual_date_earned” or is the “date_earned” column still needed for other operations?

    Thanks!

    • This reply was modified 4 years, 4 months ago by blaagrrrl.
    Plugin Author learningtimes

    (@learningtimes)

    Hi @blaagrrrl ,

    Yes, this column was added to the BadgeOS version 3.6.6. The activation and update scripts take care of automatic schema updates. Maybe there’s a permission issue for making schema changes for the website’s MySQL user.

    Anyways, for your reference following are the SQL query updates that you’ll need to have.

    ALTER TABLE wp_badgeos_achievements ADD actual_date_earned timestamp DEFAULT CURRENT_TIMESTAMP;
    ALTER TABLE wp_badgeos_points ADD actual_date_earned timestamp DEFAULT CURRENT_TIMESTAMP;
    ALTER TABLE wp_badgeos_ranks ADD actual_date_earned timestamp DEFAULT CURRENT_TIMESTAMP;

    Note: Use actual table prefix as per your wp-config.php

    Let me know if I can answer any other questions for you.

    Thanks,
    BadgeOS Support Team

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Badges don’t show up after manually assigning and entity ID is always 0’ is closed to new replies.