bbPress

Simple, fast, elegant

bbPress Plugin Browser »

Private Messaging (0.80)

Download

Version: 0.80

Other Versions

Last Updated: 2007-2-9

Requires bbPress Version: .80 or higher

Compatible up to: .80

Author Homepage »

Plugin Homepage »

Average Rating

5 stars
4 stars
3 stars
2 stars
1 star
(26)

Your Rating

Author: Joshua Hutchins


  1. Also, I think it's a good idea to let the users know how the messaging system works so I concocted this footnote:
    <div class="footnote">Messages with an envelope next to them haven't been read by the recipient. Deleting sent messages will only work if the recipient hasn't read them yet. Likewise, when you delete an incoming message, it disappears from the sender's <em>sent messages</em>.</div>

    Here is the stylesheet stuff I use to render it:
    `.footnote {
    font: 9px Verdana,Arial,Helvetica,sans-serif;
    color: #666;
    padding-top: 11px;
    }`

    Also if you want to put asterix after the headings, you can add a class="asterix" to the <h2> tags and this to your stylesheet:

    .asterix:after {
            float: left;
            clear: top;
            content: "*";
            font-family: Arial, Helvetica, sans-serif;
            margin-left: 3px;
    }
    
    .footnote:before {
            content: "*";
    }
    Posted: 2 years ago #
  2. if you want the drop down menu to use display names if available then replace the pm_user_dropdown function in bb_privatemessages.php to

    function pm_user_dropdown() {
    	global $bbdb, $bb_current_user, $bb;
    	if ( $bb->wp_table_prefix )
    		$users = $bbdb->get_results("SELECT * FROM ".$bb->wp_table_prefix."users WHERE user_status = 0 ORDER BY user_login");
    	else
    		$users = $bbdb->get_results("SELECT * FROM $bbdb->users WHERE user_status = 0 ORDER BY user_login");
    	echo '<select name="userid" id="userid">';
    
    	foreach ( $users as $user ) :
    		if ( $user->ID != $bb_current_user->ID )
    			echo "<option value='$user->ID'>".(empty($user->display_name) ? $user->user_login : $user->display_name)."</option>";
    	endforeach;
    	echo '</select>';
    }
    Posted: 2 years ago #
  3. if you'd like to use display names on received private messages then edit the file postmsg.php and replace the contents with the following

    <?php bb_get_header(); ?>
    <?php if ($bb_current_user->ID == $pmmessage->id_sender || $bb_current_user->ID == $pmmessage->id_receiver) : ?>
    <h3 class="bbcrumb"><a href="<?php option('uri'); ?>"><?php option('name'); ?></a> &raquo; <a href="<?php pm_mess_link(); ?>"><?php _e('Private Messages'); ?></a> &raquo; <?php echo $pmmessage->pmtitle;?></h3>
    
    <ol id="thread">
    
    <?php $thisuser = bb_get_user($pmmessage->id_sender); $thatuser = bb_get_user($pmmessage->id_receiver); ?>
    <li><div class="threadauthor">
    	<div class="postauthor"><?php echo "<a href=\"".get_user_link($pmmessage->id_sender)."\">".(empty($thisuser->display_name) ? $thisuser->user_login : $thisuser->display_name)."</a>"; ?></div>
    	<div class="postauthortype"><?php echo "<a href=\"".get_user_profile_link($pmmessage->id_sender)."\">".get_user_type($pmmessage->id_sender)."</a>"; ?></div>
    	<div class="avatar"><?php avatarupload_display($pmmessage->id_sender); ?></div>
    	<!-- <div class="postcount"><?php // echo "Post Count: ".get_post_count($pmmessage->id_sender); ?></div> -->
    	<!-- <?php // echo '<img src="' . get_avatar_loc( $pmmessage->id_sender ) . '">'; ?> -->
    </div>
    
    <div class="threadpost">
    	<div class="post"><?php echo pm_text($pmmessage); ?></div>
    	<div class="poststuff"><?php _e('Sent:'); ?> <?php echo get_pm_time( $pmmessage->created_on ); ?> <?php _e('To '); ?> <?php echo empty($thatuser->display_name) ? $thatuser->user_login : $thatuser->display_name; ?></div>
    </div></li>
    
    <li>
    <?php if ($bb_current_user->ID != $pmmessage->id_sender) { pm_reply_form("Reply", $pmmessage); } ?>
    </li>
    </ol>
    <?php else : echo "You can't look at this message!  It doesn't belong to you!"; endif; ?>
    
    <?php bb_get_footer(); ?>

    Then edit the message-form.php file and change the 4th line to

    <?php echo empty($thisuser->display_name) ? $thisuser->user_login : $thisuser->display_name; ?>

    Posted: 2 years ago #
  4. one last place to add the display name. Change line 4 of pm-user-form.php to

    <?php echo empty($pmuser->display_name) ? $pmuser->user_login : $pmuser->display_name; ?>

    Now you should be using display names everywhere possible in the private messages plugin except for profile links.

    Posted: 2 years ago #
  5. Hello,
    thanks for this plugin i fixed one bug. The bug is when we send pm without a subject, users cannot see the link of their message so in privatemessages.php find <?php echo " <a href=\"".bb_get_pm_link('?id='.$pm->pm_id)."\">".$pm->pmtitle."</a>"; ?> and replace with this `<?php if ($pm->pmtitle != NULL)

    echo " pm_id)."\">".$pm->pmtitle."";

    else

    echo "pm_id)."\">"."(no-subject)"; ?>`

    Posted: 2 years ago #
  6. bedbugger

    Member

    louisedade,

    I was trying to apply your fix as per your website. I THINK I followed the instructions correctly, but I am getting this error:

    I: 0 whois source Density Links: 557|1

    bbPress database error: [Unknown column 'del_receiver' in 'where clause']
    SELECT * FROM bb_privatemessages WHERE id_receiver = 1 AND del_receiver=0 ORDER BY created_on DESC

    bbPress database error: [Unknown column 'del_sender' in 'where clause']
    SELECT * FROM bb_privatemessages WHERE id_sender = 1 AND del_sender=0 ORDER BY created_on DESC

    No messages are shown in my PM page now, and it was previously full.

    Thank you!

    Posted: 2 years ago #
  7. Not working with slugs as permalink :(

    Posted: 2 years ago #
  8. Hi all,

    Seems things went quite on this so I thought I'd try again.

    I installed and brand new copy of bbPress with a new and empty DB. One by one I have been adding plugins and seeing if they work or not. When I got to this one everything installs like it should but I get this message flying by again. No PM is sent and none is received. Any help out there?

    bbPress database error: [Field 'seen' doesn't have a default value]
    INSERT INTO bb_privatemessages (id_sender, id_receiver, pmtitle, message, created_on) VALUES ('100017', '812', ' ', ' ', '2007-07-18 21:55:27')

    Posted: 2 years ago #
  9. anyone else getting this error as well? if so how did you fix it?

    Fatal error: Call to undefined function: pm_fp_link() in /home/.atlanta/netsledsnet/netsleds.com/netsleds_forums/my-templates/netsleds/front-page.php on line 77

    Posted: 2 years ago #
  10. bedbugger

    Member

    Is anyone else having trouble after installing bbpress o.83?

    I had everything running fine under my last install and I carefully reinstalled everything.

    I can go to the /pm page, and I can even send a message.

    I can't read a message by clicking on it, and I can't click "PM this user" under a post (even though I did as the instructions said). Either of those yields an error (goes to my 404 page).

    Thanks!

    Posted: 2 years ago #
  11. Thank you for the plugin :)
    I'm using it here: http://desbar.eu/

    Posted: 2 years ago #
  12. ElButch

    Member

    Hi
    I tried to install this plugin as it is described. But when I try to go to the pm.php file I get the following error:
    bbPress database error: [Table 'harlekinos.bb_privatemessages' doesn't exist]
    SELECT * FROM bb_privatemessages WHERE id_receiver = 1 ORDER BY created_on DESC
    Is there anybody that can help me fix that problem?
    Regards Butch

    Posted: 2 years ago #
  13. Hey netsleds,
    I'm having the same error:

    Fatal error: Call to undefined function: pm_fp_link() in /home/.atlanta/netsledsnet/netsleds.com/netsleds_forums/my-templates/netsleds/front-page.php on line 77

    Can anyone help?

    Posted: 2 years ago #
  14. ElButch

    Member

    It works now. I had to configure the DB myself. Thanks for this Plugin.

    Posted: 2 years ago #
  15. added a simple if if else statement to allow people style if a user has one, many or no messages.


    function pm_fp_link() {
    global $bbdb, $bb_table_prefix, $bb_current_user, $bb;

    pm_install_check();

    $num = $bbdb->get_var("SELECT COUNT(*) FROM ".$bb_table_prefix."privatemessages WHERE seen = 0 AND id_receiver = ".$bb_current_user->ID."");

    if ($num == 1)
    {
    echo "yay you have <a href=\"";
    echo apply_filters('pm_fp_link', get_pm_fp_link() );
    echo "\">".$num." new message.";

    }

    if ($num >= 2)
    {
    echo "excellent you have <a href=\"";
    echo apply_filters('pm_fp_link', get_pm_fp_link() );
    echo "\">".$num." new messages.";

    }

    else if ($num <= 0)
    {
    echo "sorry you have 0 messages";
    }
    }

    Posted: 2 years ago #
  16. Anyone using this with bbpress 0.8.3.1 and Wordpress 2.3.3?

    Posted: 2 years ago #
  17. Testing now. http://www.koma-inu.org

    Posted: 2 years ago #
  18. To fix a probably XSS&flood bug in message.php:

    <?php
    require_once('./bb-load.php');
    
    if ( isset($_GET['id']) ) :
    	(int) $messageid = $bbdb->escape(strip_tags($_GET['id']));
    else :
    	(int) $messageid = 0;
    endif;
    
    if ( ($messageid > 0) && ($messageid < 10) ) :
    	$pmmessage = pm_get_message( $messageid );
    
    	if ($bb_current_user->ID == $pmmessage->id_receiver) :
    		pm_seen( $messageid );
    	endif;
    
    elseif ( isset($_GET['user']) && (strlen($_GET['user']) < 10) ) :
    	$toid = (is_numeric($_GET['user'])) ? (int) $bbdb->escape(strip_tags($_GET['user'])) : bb_die('Error: User don\'t exists.');
    
    	if ($bb->wp_table_prefix) :
    		$touser = $bbdb->get_row("SELECT * FROM ".$bb->wp_table_prefix."users WHERE ID = $toid");
    	else :
    		$touser = $bbdb->get_row("SELECT * FROM ".$bb_table_prefix."users WHERE ID = $toid");
    	endif;
    
    	pm_user_form( $touser, '' );
    	exit;
    
    else :
    	bb_die('Error: Unknow message or user.');
    endif;
    
    bb_load_template( 'postmsg.php', array( 'messageid', 'pmmessage', 'touser', 'toid' ) );
    ?>
    Posted: 1 year ago #
  19. Ups, I'm going nuts... SQL Injection, not XSS
    :P

    Posted: 1 year ago #
  20. citizenkeith

    5 stars
    4 stars
    3 stars
    2 stars
    1 star

    Member

    Thanks again for a great plugin. My forum buddies couldn't live without it. Would love to see email notification of Private Messages.

    Posted: 1 year ago #

RSS feed for this topic

Add a Comment »

You must log in to post.

Code is Poetry.