forum.coppermine-gallery.net

Support => Deutsch (German) => Language Specific Support => cpg1.4.x Deutsch (German) => Topic started by: M4rkus on April 08, 2010, 05:41:31 pm

Title: Usergruppe hinter dem Namen des Kommentators anzeigen lassen !
Post by: M4rkus on April 08, 2010, 05:41:31 pm
Hallo,

meine CPG: https://www.naturfoto-galerie.net

Gibt es eine Möglichkeit die Usergruppe hinter dem Namen des Kommentarschreibers anzuzeigen ?
Z.b lege ich eine Gruppe namens Moderator an, schiebe bestimmte Benutzer dort hinein,
dann soll in den Kommentaren hinter dem Namen der Gruppenname stehen.

Ich schätze das wäre ein erheblicher Programmieraufwand ?
Title: Re: Usergruppe hinter dem Namen des Kommentators anzeigen lassen !
Post by: Αndré on April 13, 2010, 02:01:15 pm
Das ist eigentlich kein großes Problem. Wo soll die Gruppenzugehörigkeit denn angezeigt werden? Lediglich bei den Kommentaren unter einem Bild?
Title: Re: Usergruppe hinter dem Namen des Kommentators anzeigen lassen !
Post by: M4rkus on April 14, 2010, 07:54:37 am
Das ist eigentlich kein großes Problem. Wo soll die Gruppenzugehörigkeit denn angezeigt werden? Lediglich bei den Kommentaren unter einem Bild?

Hallo Andre,

ja, das würde mir schon völlig reichen, direkt rechts hinter dem Namen des Kommentierenden.
Title: Re: Usergruppe hinter dem Namen des Kommentators anzeigen lassen !
Post by: Αndré on April 14, 2010, 10:44:05 am
Kopiere folgende Funktion in die Datei themes/<Dein Theme>/themes.php:
Code: [Select]
function theme_html_comments($pid)
{
    global $CONFIG, $USER, $CURRENT_ALBUM_DATA, $comment_date_fmt, $HTML_SUBST;
    global $template_image_comments, $template_add_your_comment, $lang_display_comments;

    $html = '';

    // report to moderator buttons
    if (!(($CONFIG['report_post']==1) && (USER_CAN_SEND_ECARDS))) {
        template_extract_block($template_image_comments, 'report_comment_button');
    }

    if (!$CONFIG['enable_smilies']) {
        $tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_no_smilies', '{EDIT}');
        template_extract_block($template_image_comments, 'edit_box_smilies');
        template_extract_block($template_add_your_comment, 'input_box_smilies');
    } else {
        $tmpl_comment_edit_box = template_extract_block($template_image_comments, 'edit_box_smilies', '{EDIT}');
        template_extract_block($template_image_comments, 'edit_box_no_smilies');
        template_extract_block($template_add_your_comment, 'input_box_no_smilies');
    }

    $tmpl_comments_buttons = template_extract_block($template_image_comments, 'buttons', '{BUTTONS}');
    $tmpl_comments_ipinfo = template_extract_block($template_image_comments, 'ipinfo', '{IPINFO}');

    if ($CONFIG['comments_sort_descending'] == 1) {
        $comment_sort_order = 'DESC';
    } else {
        $comment_sort_order = 'ASC';
    }
    $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");

    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 : '';

        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 = '';
        }

        $ip = $row['msg_hdr_ip'];
        if ($row['msg_hdr_ip'] != $row['msg_raw_ip']) {
            $ip .= ' [' . $row['msg_raw_ip'] . ']';
        }

        $params = array('{EDIT}' => &$comment_edit_box,
            '{BUTTONS}' => &$comment_buttons,
            '{IPINFO}' => &$comment_ipinfo
            );

        $template = template_eval($template_image_comments, $params);

        $row['group_name'] = mysql_result(cpg_db_query("SELECT group_name FROM {$CONFIG['TABLE_USERS']} u INNER JOIN {$CONFIG['TABLE_USERGROUPS']} g ON u.user_group = g.group_id WHERE user_id = '".$row['author_id']."'"), 0);

        $params = array('{MSG_AUTHOR}' => stripslashes($row['msg_author']." ({$row['group_name']})"),
            '{MSG_ID}' => $row['msg_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']
            );

        $html .= template_eval($template, $params);
    }

    if (USER_CAN_POST_COMMENTS && $CURRENT_ALBUM_DATA['comments'] == 'YES') {
        if (USER_ID) {
            $user_name_input = '<tr><td><input type="hidden" name="msg_author" value="' . stripslashes(USER_NAME) . '" /></td>';
            template_extract_block($template_add_your_comment, 'user_name_input', $user_name_input);
            $user_name = '';
        } else {
            if (isset($USER['name'])) {
              $user_name = strtr($USER['name'], $HTML_SUBST);
            } else {
              $user_name = $lang_display_comments['your_name'];
            }
        }

        $params = array('{ADD_YOUR_COMMENT}' => $lang_display_comments['add_your_comment'],
            // Modified Name and comment field
            '{NAME}' => $lang_display_comments['name'],
            '{COMMENT}' => $lang_display_comments['comment'],
            '{PIC_ID}' => $pid,
            '{USER_NAME}' => $user_name,
            '{MAX_COM_LENGTH}' => $CONFIG['max_com_size'],
            '{OK}' => $lang_display_comments['OK'],
            '{SMILIES}' => '',
            '{WIDTH}' => $CONFIG['picture_table_width'],
            );

        if ($CONFIG['enable_smilies']){
                        $params['{SMILIES}'] = generate_smilies();
                } else {
                        template_extract_block($template_add_your_comment, 'smilies');
                }

        $html .= template_eval($template_add_your_comment, $params);
    }

    return $html;
}
Title: Re: Usergruppe hinter dem Namen des Kommentators anzeigen lassen !
Post by: M4rkus on April 14, 2010, 01:51:47 pm
Hallo Andre,

vielen Dank für die wieder mal schnelle Hilfe ;)

Habe die vorhandene Funktion mit deiner geposteten ersetzt und es funktioniert einwandrei !

Beste Grüße...Markus.