<span class="SpecSource"> <a href="<?php echo getProfileLink($post->post_author); ?> "> <?php echo nm_user_public_name($post->post_author); ?> </a> </span> </span> <img src="<?php bloginfo('stylesheet_directory'); ?> /images/common/rating-<?php echo nm_get_photo_rating($post->ID); ?> -stars.gif" alt="review rating"/> </div> <?php } } else { ?> <p class="message">There are currently no photos available</p> <?php } ?> <!-- pagination --> <div class="pagination"> <div class="navigation"><p> <?php
function nm_rate_photo($postID, $userID, $rating) { $post_meta = get_post_meta($postID, 'rating', true); $rating_meta = $post_meta; if (!is_array($post_meta)) { $rating_meta = array(); } if (!$rating_meta[$userID]) { $rating_meta[$userID] = $rating; if (!$post_meta) { add_post_meta($postID, 'rating', $rating_meta); } else { update_post_meta($postID, 'rating', $rating_meta); } } $newRating = nm_get_photo_rating($postID); return $newRating; }