Advanced search  

News:

cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.
[more]

Pages: [1] 2 3 4   Go Down

Author Topic: Private Messaging System  (Read 83533 times)

0 Members and 1 Guest are viewing this topic.

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 6006
Private Messaging System
« on: October 31, 2007, 01:59:25 am »

This plugin allows you to send private messages to other registered users.
Actually this plugin works for an unbridged coppermine. It'll add a send pm functionality and one to view PMs. Also there is bridge support built in. For now the smf10 works too. It's not that easy to add other bridges cause the bridge files aren't written in the same style. Therefore the way to go would be to hardcode some routines.

In bridged mode the plugin uses the forums PM functions and just adds 'send PM' links in thumbnail view, above the intermediate image and if you copy/ paste the contents of theme_changes.txt to your theme.php another 'send PM' link next to commenter names.

In the admin menu a 'PMS' button will appeare. You can make some settings here
 - enable/ disable pm
 - a bunch of other stuff like smilies etc... some are not yet implemented
important is
Display pm status info when logged in - this will add some statistics (Private Messages:  2 unread, total 9)
Display login form - will show a login box if a user isn't logged in, the above stats at that place when logged in

An english lang file is added. You can add new lang files... the sheme is similar to the other cpg lang files.

Installation:
- unzip and upload to your plugins folder, use the plugin manager to install it
- have a look into the folder images_to_move
   -> copy all images within this folder to your themes images folder (eg themes/classic/images)
   -> copy/ paste the contents from css_changes.txt to your themes css file (eg themes/classic/style.css)
   -> copy/ paste the contents of theme_changes.txt to your theme.php (eg themes/classic/theme.php)
       [no biggie if you don't do that, however the 'send PM' link won't then display next to the username within comments]
   -> if you want to display a 'send PM' link in the user profile, you'll have to manually edit profile.php. Version 1.1 of the plugin introduces a plugin hook in profile.php to reduce the editing amount.

in profile.php find (at the end of the code)
Code: [Select]
        make_form($display_profile_form_param, $form_data);
and replace with
Code: [Select]
        //added for plugin support - PMS
$profile_data = CPGPluginAPI::filter('profile_add_data', array ( 0 => $display_profile_form_param, 1 => $form_data ));
        make_form($profile_data[0], $profile_data[1]);

that's it with editing

The login form by default is placed after the sub  menu. If you want it to appeare somewhere else, then add
Code: [Select]
{LOGIN_FORM}to your template.html.

New version (1.1 uploaded on 11/02/2007)
 - added plugin hook in profile.php and changed code in codebase.php to make use of that hook to add data to the profile (send PM link)
« Last Edit: November 02, 2007, 10:28:13 am by Stramm »
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/

bigarte

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 12
  • Oz Sapper
    • Free Windows Wallpapers
Re: Private Messaging System
« Reply #1 on: November 02, 2007, 08:30:58 am »

Very nice Stramm; thanks.
Logged

Su8Z3r0

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Private Messaging System
« Reply #2 on: November 12, 2007, 12:30:53 pm »

Hi there Great plug in thx. just 1 thing i found is that the Pm link in the comments dont work. click on pm next to user name and it just comes up with The webpage cannot be found HTTP404. But all the other pm links work.
ive installed it all as it says, checked it. Is it the same for anyone else? or is it just me.

thx
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 6006
Re: Private Messaging System
« Reply #3 on: November 12, 2007, 02:13:26 pm »

Yes, seems I have added an older version of the theme changes to the zip.
Find below what I intended to put there

Code: [Select]
if ($CONFIG['pms_enabled']) {
$pm_link = "<cite><a href=\"{PM_LINK}{AUTHOR_ID}\"><img src='{THEME_DIR}images/pm.gif' width=\"16\" height=\"11\" border=\"0\" alt=\"Send PM\" /></a></cite>";
}
$template_image_comments = <<<EOT
<table align="center" width="{WIDTH}" cellspacing="1" cellpadding="0" class="maintable">

        <tr>
                <td>
                        <table width="100%" cellpadding="0" cellspacing="0">
                           <tr>
                                <td class="tableh2_compact" nowrap="nowrap">
                                        <b>{MSG_AUTHOR}</b><a name="comment{MSG_ID}"></a>&nbsp;
$pm_link
<!-- BEGIN ipinfo -->
                                                                                 ({IP})
<!-- END ipinfo -->
</td>


                                <td class="tableh2_compact" align="right" width="100%">
<!-- BEGIN report_comment_button -->
     <a href="report_file.php?pid={PID}&amp;msg_id={MSG_ID}&amp;what=comment" title="{REPORT_COMMENT_TITLE}"><img src="images/report.gif" width="16" height="16" border="0" align="middle" alt="{REPORT_COMMENT_TITLE}" /></a>
<!-- END report_comment_button -->


<!-- BEGIN buttons -->
                                        <a href="javascript:;" onclick="blocking('cbody{MSG_ID}','', 'block'); blocking('cedit{MSG_ID}','', 'block'); return false;" title="{EDIT_TITLE}"><img src="images/edit.gif" border="0" align="middle" /></a>
                                        <a href="delete.php?msg_id={MSG_ID}&what=comment"  onclick="return confirm('{CONFIRM_DELETE}');"><img src="images/delete.gif" border="0" align="middle" /></a>
<!-- END buttons -->
                                </td>
                                <td class="tableh2_compact" align="right" nowrap="nowrap">
                                        <span class="comment_date">[{MSG_DATE}]</span>
                                </td></tr>
                        </table>
                </td>
        </tr>
        <tr>
                <td class="tableb_compact">
                        <div id="cbody{MSG_ID}" style="display:block">
                                {MSG_BODY}
                        </div>
                        <div id="cedit{MSG_ID}" style="display:none">
<!-- BEGIN edit_box_smilies -->
                                <table width="100%" cellpadding="0" cellspacing="0">

                                                <form name="f{MSG_ID}" method="POST" action="db_input.php">
                                                <input type="hidden" name="event" value="comment_update" />
                                                <input type="hidden" name="msg_id" value="{MSG_ID}" />
                                                <tr>
                                                <td>
                                                   <input type="text" name="msg_author" value="{MSG_AUTHOR}" class="textinput" size="25" />
                                                </td><td>
                                                </tr>
                                                <tr>
                                                <td width="80%">
                                                        <textarea cols="40" rows="2" class="textinput" name="msg_body" onselect="storeCaret_f{MSG_ID}(this);" onclick="storeCaret_f{MSG_ID}(this);" onkeyup="storeCaret_f{MSG_ID}(this);" style="width: 100%;">{MSG_BODY_RAW}</textarea>
                                                </td>
                                                <td class="tableb_compact">
                                                </td>
                                                <td>
                                                        <input type="submit" class="comment_button" name="submit" value="{OK}" />
                                                </td>
                                                </form>
                                        </tr>
                                        <tr>
                                                <td colspan="3"><img src="images/spacer.gif" width="1" height="2" /><br /></td>
                                        </tr>
                                </table>
                                {SMILIES}
<!-- END edit_box_smilies -->
<!-- BEGIN edit_box_no_smilies -->
                                <table width="100%" cellpadding="0" cellspacing="0">
                                        <tr>
                                                <form name="f{MSG_ID}" method="POST" action="db_input.php">
                                                <input type="hidden" name="event" value="comment_update" />
                                                <input type="hidden" name="msg_id" value="{MSG_ID}" />
                                                <td>
                                                <input type="text" name="msg_author" value="{MSG_AUTHOR}" class="textinput" size="25" />
                                                </td>
                                        </tr>
                                        <tr>
                                                <td width="100%">
                                                        <textarea cols="40" rows="2" class="textinput" name="msg_body" style="width: 100%;">{MSG_BODY_RAW}</textarea>
                                                </td>
                                                <td class="tableb_compact">
                                                </td>
                                                <td>
                                                        <input type="submit" class="comment_button" name="submit" value="{OK}" />
                                                </td>
                                                </form>
                                        </tr>
                                        <tr>
                                                <td colspan="3"><img src="images/spacer.gif" width="1" height="2" /><br /></td>
                                        </tr>
                                </table>
<!-- END edit_box_no_smilies -->
                        </div>
                </td>
        </tr>
</table>
EOT;



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, $THEME_DIR;

    $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);

        $params = array('{MSG_AUTHOR}' => stripslashes($row['msg_author']),
            '{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'],
            '{THEME_DIR}' => $THEME_DIR,
            '{AUTHOR_ID}' => $row['author_id'],
            '{PM_LINK}' => PM_LINK
            );

        $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;
}
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Private Messaging System
« Reply #4 on: November 13, 2007, 06:01:20 pm »

Hi Stramm

I've moved the {LOGIN_FORM} around to where I want it and I have it on the right side of my gallery where everything is aligned left. I've tried aligning it left in my template.html but it still stays on the right. Is there anywhere in the plugin that I can change to make it align left?

Thanks ;)
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 6006
Re: Private Messaging System
« Reply #5 on: November 13, 2007, 06:06:57 pm »

codebase.php, function pms_loginform ... have a look at the html there
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/

Su8Z3r0

  • Coppermine newbie
  • Offline Offline
  • Posts: 10
Re: Private Messaging System
« Reply #6 on: November 13, 2007, 07:53:24 pm »

Works a treat now Stramm. many thx
Logged

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Private Messaging System
« Reply #7 on: November 13, 2007, 08:00:38 pm »

Gone into the codebase.php changed what I think is the right piece of code so I've changed it to 'left' like so:

Code: [Select]
if (USER_ID) {

                           $loginFormHtml = "<div align=\"left\" class=\"smallfont\">".$lang_pms_sys['welcome']." <strong>".(USER_NAME)."</strong><br/></div>";

But is still aligned right! ???

Am I missing something, by the way its the section of the plugin when logged in and showing how many pms I have is the bit what I need aligning.

Thanks
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 6006
Re: Private Messaging System
« Reply #8 on: November 13, 2007, 08:05:02 pm »

link?
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Private Messaging System
« Reply #9 on: November 13, 2007, 08:13:55 pm »

Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 6006
Re: Private Messaging System
« Reply #10 on: November 13, 2007, 08:46:08 pm »

user/ pass doesn't work for me
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Private Messaging System
« Reply #11 on: November 13, 2007, 08:53:53 pm »

Did you log into the forum here as my gallery is bridged:

http://cdcoverhideout.com/newforum

You will see a gallery link in the forum once logged in ;)
Logged

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Private Messaging System
« Reply #12 on: November 13, 2007, 08:54:50 pm »

sorry my bad:

u/n = test

p/w = emmahurry ;)
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 6006
Re: Private Messaging System
« Reply #13 on: November 13, 2007, 09:02:40 pm »

had a look at your code... here I see that
Code: [Select]
$loginFormHtml = "<div align=\"right\" class=\"smallfont\">".$lang_pms_sys['welcome']." <strong>".(USER_NAME)."</strong><br />";
hasn't been changed to
Code: [Select]
$loginFormHtml = "<div align=\"left\" class=\"smallfont\">".$lang_pms_sys['welcome']." <strong>".(USER_NAME)."</strong><br />";

or you have another plugin/ mod tunning that overrides the pm function (modpack is one and there's my login form plugin)

That's the output (from your sites source)
Code: [Select]
<h2>My Account</h2>
<left></left><div class="smallfont" align="right">Welcome back <strong>test</strong><br><a
you see... still align right (btw. what's the use of <left></left>)
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Private Messaging System
« Reply #14 on: November 13, 2007, 09:07:00 pm »

haven't added that, I'll take another look ;)
Logged

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Private Messaging System
« Reply #15 on: November 13, 2007, 09:13:44 pm »

I must of added that anyway took it out I've attached the file to show that I have changed to left but still the same ???
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 6006
Re: Private Messaging System
« Reply #16 on: November 14, 2007, 07:45:42 am »

your change in that file doesn't reflect on your site. Are you sure you've uploaded and overwritten the original codebase.php in the photo_shop plugin dir?

I've seen that you use IPB... that's not yet supported unless you write bridge support for it
Code: [Select]
Actually this plugin works for an unbridged coppermine. It'll add a send pm functionality and one to view PMs. Also there is bridge support built in. For now the smf10 works too.
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/

will

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 263
Re: Private Messaging System
« Reply #17 on: November 14, 2007, 09:57:49 am »

ok, didn't read that part of the thread, I'll wait for IPB support has I'm not good with PHP coding ;D
Logged

PHIPHI

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 1
    • L'album photos de famille
Re: Private Messaging System
« Reply #18 on: January 17, 2008, 03:08:48 pm »

Bonjour,

Voici ma modeste contribution à ce magnifique plugin qu'est "Messages privés".
Vous trouverez en pièce jointe, la version française de cpg_pms.

Tous les fichiers du plugin ont été traduit en français.

Bonne installation

DPH91
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 6006
Re: Private Messaging System
« Reply #19 on: January 17, 2008, 03:18:08 pm »

thanks for your contribution
Logged
my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/
Pages: [1] 2 3 4   Go Up
 

Page created in 0.025 seconds with 21 queries.