forum.coppermine-gallery.net
Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: mahdi1234 on September 16, 2009, 09:58:43 pm
-
hello,
Is there a way how to make picture owner to have a different profile link color in comments? What I mean is lets say it's underlined red and comments from other users in a normal way.
I've had a look into theme.php, but there doesn't seem to be a way how to execute query inside of $template_image_comments block, would you have some suggestion on how to achive this?
thanks,
mahdi
-
I won't be able to provide you with more than this....
But look in sample/theme.php for:
// Displays comments for a specific picture
function theme_html_comments($pid)
{
And you will find $comment_body - where you might be able to apply your mod
if ($CONFIG['enable_smilies']) {
$comment_body = process_smilies(make_clickable($row['msg_body']));
$smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
} else {
$comment_body = make_clickable($row['msg_body']);
$smilies = '';
Remember to copy the complete function over to your theme.php. - all the way through to:
return $html;
}
Good Luck!
-
Now I have re-read your post, you want to mark/highlight the name, not the comment.
The message author's name is in the same function as above (function theme_html_comments)
$result = cpg_db_query("SELECT msg_id, msg_author, msg_body, UNIX_TIMESTAMP(msg_date) AS msg_date,
author_id, author_md5_id, msg_raw_ip, msg_hdr_ip, pid FROM {$CONFIG['TABLE_COMMENTS']} WHERE pid='$pid'
ORDER BY msg_id $comment_sort_order");
-
Thanks for pointer i-imagine :)
Here we go (I'm not coding in php, so might be bit lame, but works) all edits are done in theme.php (in my case hardwired). Should not those be present in your theme, copy first from sample one.
function function theme_html_comments($pid)
add at the beginning of the fucntion:
global $CURRENT_PIC_DATA;
global $USER_DATA;
$picture_owner = $CURRENT_PIC_DATA['owner_id'];
$current_user = $USER_DATA['user_id'];
replace
while ($row = mysql_fetch_array($result)) {
$user_can_edit = (GALLERY_ADMIN_MODE) || (USER_ID && USER_ID == $row['author_id'] && USER_CAN_POST_COMMENTS) || (!USER_ID && USER_CAN_POST_COMMENTS && ($USER['ID'] == $row['author_md5_id']));
$comment_buttons = $user_can_edit ? $tmpl_comments_buttons : '';
$comment_edit_box = $user_can_edit ? $tmpl_comment_edit_box : '';
$comment_ipinfo = ($row['msg_raw_ip'] && GALLERY_ADMIN_MODE)?$tmpl_comments_ipinfo : '';
with
while ($row = mysql_fetch_array($result)) {
$user_can_edit = (GALLERY_ADMIN_MODE) || (USER_ID && USER_ID == $row['author_id'] && USER_CAN_POST_COMMENTS) || (!USER_ID && USER_CAN_POST_COMMENTS && ($USER['ID'] == $row['author_md5_id']));
$comment_buttons = $user_can_edit ? $tmpl_comments_buttons : '';
$comment_edit_box = $user_can_edit ? $tmpl_comment_edit_box : '';
$comment_ipinfo = ($row['msg_raw_ip'] && GALLERY_ADMIN_MODE)?$tmpl_comments_ipinfo : '';
# check comment author ID
$comment_author = $row['author_id'];
replace
if ($CONFIG['enable_smilies']) {
$comment_body = process_smilies(make_clickable($row['msg_body']));
$smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
} else {
$comment_body = make_clickable($row['msg_body']);
$smilies = '';
with (now I don't have smilies enabled, so did not bother to define it for both cases, need to be adjusted in such case for other condition)
if ($CONFIG['enable_smilies']) {
$comment_body = process_smilies(make_clickable($row['msg_body']));
$smilies = generate_smilies("f{$row['msg_id']}", 'msg_body');
} else {
$comment_body = make_clickable($row['msg_body']);
$smilies = '';
# define variableS
if ($current_user == $comment_author){
$author_color = '<font color=#111111>';
}
elseif ($picture_owner == $comment_author) {
$author_color = '<font color=#cccccc>';
}
else {
$author_color = '<font>';
}
}
replace
$params = array('{MSG_AUTHOR}' => stripslashes($row['msg_author']),
'{MSG_ID}' => $row['msg_id'],
'{MSG_AUTHOR_ID}' => $row['author_id'],
'{PID}' => $row['pid'],
'{EDIT_TITLE}' => &$lang_display_comments['edit_title'],
'{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'],
'{MSG_DATE}' => localised_date($row['msg_date'], $comment_date_fmt),
'{MSG_BODY}' => bb_decode($comment_body),
'{MSG_BODY_RAW}' => $row['msg_body'],
'{OK}' => &$lang_display_comments['OK'],
'{SMILIES}' => $smilies,
'{IP}' => $ip,
'{REPORT_COMMENT_TITLE}' => &$lang_display_comments['report_comment_title'],
'{WIDTH}' => $CONFIG['picture_table_width'],
);
with
$params = array('{MSG_AUTHOR}' => stripslashes($row['msg_author']),
'{MSG_ID}' => $row['msg_id'],
'{MSG_AUTHOR_ID}' => $row['author_id'],
'{PID}' => $row['pid'],
'{EDIT_TITLE}' => &$lang_display_comments['edit_title'],
'{CONFIRM_DELETE}' => &$lang_display_comments['confirm_delete'],
'{MSG_DATE}' => localised_date($row['msg_date'], $comment_date_fmt),
'{MSG_BODY}' => bb_decode($comment_body),
'{MSG_BODY_RAW}' => $row['msg_body'],
'{OK}' => &$lang_display_comments['OK'],
'{SMILIES}' => $smilies,
'{IP}' => $ip,
'{REPORT_COMMENT_TITLE}' => &$lang_display_comments['report_comment_title'],
'{WIDTH}' => $CONFIG['picture_table_width'],
'{AUTHOR_COLOR}' => $author_color
);
in template $template_image_comments = <<<EOT
in relevant part add {AUTHOR_COLOR} and escape font e.g.
<a href ="profile.php?uid={MSG_AUTHOR_ID}"><b>{AUTHOR_COLOR}{MSG_AUTHOR}</font></b></a>