Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display badge image on award pages #38

Open
davelester opened this issue Nov 4, 2012 · 1 comment
Open

display badge image on award pages #38

davelester opened this issue Nov 4, 2012 · 1 comment

Comments

@davelester
Copy link
Owner

Badge images are currently displayed on pages for each badge; they should be added to each award page so it's clear what badge was awarded. This is a matter of retrieving the badge post ID from the award post meta field, and displaying the featured image for the badge post id.

@bwarters
Copy link

I took a crack at this and got it working to some extent. It doesn't yet keep the badge image in view after the accept or decline action has been taken, but it is a start. I edited the includes/awards.php, changing the block if ($award_status == 'Awarded') to the following:

       if ($award_status == 'Awarded')
        {
            $badge_title = esc_html( get_the_title( get_post_meta( $post_id, 'wpbadger-award-choose-badge', true ) ) );
$badge_thumbnailhtml = get_the_post_thumbnail( get_post_meta( $post_id, 'wpbadger-award-choose-badge', true ), 'thumbnail' );
            $content = <<<EOHTML
                <div id="wpbadger-award-actions-wrap">
                <div id="wpbadger-award-actions" class="wpbadger-award-notice">
                    <p>Congratulations! The "{$badge_title}" badge has been awarded to you.</p>
                    <p>Please choose to <a href='#' class='acceptBadge'>accept</a> or <a href='#' class='rejectBadge'>decline</a> having the award added to your OpenBadges Backpack.</p>
                </div>
                <div id="wpbadger-award-browser-support" class="wpbadger-award-error">
                    <p>Microsoft Internet Explorer is not supported at this time. Please use Firefox or Chrome to retrieve your award.</p>
                </div>
                <div id="wpbadger-award-actions-errors" class="wpbadger-award-error">
                    <p>An error occured while adding this badge to your backpack.</p>
                </div>
<div id="mybadgeimage" style="margin-left:40px;">{$badge_thumbnailhtml}</div>
                </div>
                {$content}
EOHTML;
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants