After long time Out in "todash" I'm here again...
Today I made 2 modifications to the album for:
1.- View how many votes an image has
2.- View who rated the photo.
To do so:
Open album_showpage.php
Find
- $sql = "SELECT p.*, ac.*, u.user_id, u.username, u.user_rank, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT( DISTINCT c.comment_id) AS comments_count
InLine After add
Find
After add
Find
- if( empty($thispic) )
- {
- message_die(GENERAL_ERROR, $lang['Pic_not_exist'] . $lang['Nav_Separator'] . $pic_id);
- }
After add
- // ------------------------------------
- // Check users that voted
- // ------------------------------------
- $sql = "SELECT r.rate_user_id, u.user_id, u.username
- FROM " . ALBUM_RATE_TABLE . " AS r
- LEFT JOIN ". USERS_TABLE ." AS u on r.rate_user_id = u.user_id
- WHERE rate_pic_id = '$pic_id'
- ORDER BY rate_user_id" ;
- if($result = $db->sql_query($sql))
- {
- if (!empty($result))
- {
- while ($users_rated = $db->sql_fetchrow($result))
- {
- $style_color = color_group_colorize_name($users_rated['user_id']);
- $users_that_rated .= ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $users_rated['user_id']) . '" class="gensmall">' . $style_color . '</a>, ';
- }
- }
- $db->sql_freeresult($result);
- }
- if (!$users_that_rated)
- {
- $users_that_rated = '<i>' . $lang['no_one_rated'] . '</i>';
- }
- // ------------------------------------
- // End Check users that voted
- // ------------------------------------
Find:
After add:
- 'PIC_RATINGS_COUNT' => $total_ratings,
- 'TOTAL_USERS_VOTED' => $users_that_rated,
Find:
After add:
- 'L_TOTAL_RATINGS' => $lang['total_ratings'],
- 'L_USERS_VOTED' => $lang['users_voted'],
Open templates/*/album_showpage_body.tpl
Find:
Before add:
- <tr>
- <td valign="top" align="right"><span class="genmed">{L_TOTAL_RATINGS}:</td>
- <td valign="top" align="left"><b><span class="genmed">{PIC_RATINGS_COUNT}</b></td>
- </tr>
- <tr>
- <td valign="top" align="right"><span class="genmed">{L_USERS_VOTED}:</td>
- <td valign="top" align="left"><b><span class="genmed">{TOTAL_USERS_VOTED}</b></td>
- </tr>
Open language/*/lang_album_main.php
Find
After add
- $lang['total_ratings']='Total Rates';
- $lang['no_one_rated'] = 'Nobody still rated';
- $lang['users_voted'] = 'Users that already rated';
Save / Close All Files
I feel sorry for a new DB query... I'm sure that it could have been done without it, but I've been unable.
You can see an example here: http://www.ka-tet-corp.com/portal2.....php?pic_id=803
I've tested it on a live phpBB XS 2











C?rdoba





Dresden


Borgo San Michele
BA
