Achievement list not displaying all achievements
-
Hi there! I am super new to programming so I’m sure the error I am running into is because of my lack of knowledge but here is my problem. ??
I am creating a form within our companies Intranet site that will allow users to nominate an employee for a badge based on a company value they exhibited. Such as, Lisa displayed “Compassion” when she helped this patron.
The form will send an eCard to the employee to let them know they were nominated with a personal message from the employee that nominated them.
I am having trouble creating this form and I am hoping for a little advice. Here’s what I’ve done so far:
I created an achievement type of Badges. I also created 9 achievements within the Badges type to represent the company values. They are all set up to be earned by a nomination.
Within the nomination form, the user chooses the employee they would like to nominate, then select the value they are nominating them for. So, I would like to display a list of the achievements within the Badges type in a form that will act as radio buttons.
I know that to display a list of achievements I can just simply call the shortcode [badgeos_achievements_list] but I don’t want the user to have to then click on the achievement name and be taken to a different page to submit the form.
I wrote the following code to display the achievement types list in a table but for some reason it will only display 5 achievements out of the 9. It pulls the first 5 achievements in the database based on the time they were put into the database. Does anyone know why this would be happening?
<h2>DFL Value:</h2>
<?php
$achievements = badgeos_get_achievements();
echo ‘<table>’;
foreach ($achievements as $achievement){
$post_id = $achievement->ID;
$image = badgeos_get_achievement_post_thumbnail($post_id);
echo ‘<tr><td class=”badgeimage” style=”vertical-align:middle; width:125px;”><input type=”radio” name=”achievement” value=”‘ . $achievement->ID . ‘”>’ . $image . ‘</td>’ . ‘<td class=”badgetext”><p style=”vertical-align:middle; margin-top:-25px;”><h2>’ . $achievement->post_title . ‘</h2>’ . $achievement->post_content . ‘</p></td></tr>’;
}
echo ‘</table>’;
?>Like I said, I am really new to this so I suspect I’ve messed something up with my foreach loop but I just can’t figure it out.
Thank you so much for your help!
- The topic ‘Achievement list not displaying all achievements’ is closed to new replies.