It would be a very nice feature to let the administrator specify a welcoming message that gets put into users' inboxes upon registration to the site. This would not only make the site very friendly, it would draw attention to the private message feature.

Comments

fool2’s picture

I like that idea a lot.

I think what we need to do is come up with a cross-module function that we can use- perhaps something like privatemsg_create($message) that works sort of like the _privatemsg_form() function except without the form part

The rest is easy, just plug it into the admin form.

Is anybody working on new features for privatemsg at the moment? I will most likely have to develop some significant features for a project I'm working on but I'd like to know if anyone else is doing the same thing so we don't invent separate wheels. Much of this involves extensibility so that modules can use the functionality (Hell, this should be a core module... drupal_set_message() and emails are extremes and we need a middle ground)

I also don't want to invest time if there is going to be a sea change in the way we are doing private messages. (for instance, somebody suggested using nodes)

robertdouglass’s picture

I'll be doing work on the module, too, so lets coordinate, by all means.

fool2’s picture

Ok, for that function I think everything is straightforward except the recipient field. We could do it with the same array input as user_load()...

For instance.... $message->recipient = array('uid'=>232);
or $message->recipient = array('name'=>'Fool2');

Or we could just do it to uid, since that's the best way to identify someone. This could also be used for broadcast messages though- though I don't think that applies to this specific feature idea.

A broadcast message could be sent to people using recipient = array('receive_updates'=>1) or something like that...

I also think the email interface for this is pretty inadequate. Why shouldn't people have the option to get emailed everytime they get a PM? But I digress.

What do you visualize as far as the rest of the contribution goes?

robertdouglass’s picture

I imagine things like restricting the people one can send messages to by role, or by buddylist. There are lots of opportunities for messaging between modules, for example when someone adds you to their buddylist, the buddylist currently uses drupal_set_message, yet sending a private message would be much nicer. Then there are interface improvements, and more configurability, like you pointed out. A good brainstorming thread on the open forums would be a good idea.

Patrick Nelson’s picture

What about some type of instant messaging feature?

There used to be a module that did this - Chat - but that hasn't been updated in 6 months (see ).

The way I see it working would be an integration with buddylist to take advantage of the ability to see buddies who are online at the same time you are and send them a message via privatemsg. The recipient would receive notification that they've just been sent a message (pop-up window? appears on next screen? ???).

Patrick Nelson’s picture

Sorry, post somehow got truncated. Repeated again:

What about some type of instant messaging feature?

There used to be a module that did this - Chat - but that hasn't been updated in 6 months (see CVS repository).

Perhaps combine this with buddylist so you can see buddies who are currently online and have the option to send them an instant message (still dropping into inbox as usual).

The recipient receives notification that they have been sent a message. Via a pop-up window? On the next screen they view?

Alternatively (or, as well as), what about some kind of shoutbox functionality? That seems to have died a death on Drupal as well as far as 4.7 capable modules are concerned.

fool2’s picture

http://drupal.org/node/51077 - Brainstorm forum thread

fool2’s picture

function _privatemsg_send($msg){
	if($msg){
	//$msg is an object 
	//$msg->author
	//$msg->recipient - UID of recipient. I wanted to put in a user_load type array but I'd rather keep this lightweight
	//$msg->message - msg body.  
	//$msg->format is input format. most applications of this function will probably have this as an admin setting
	$msg->author = $msg->author ? $msg->author : 1;
	$msg->hostnamge = $msg->hostname ? $msg->hostname : 'localhost';
	$msg->timestamp = $msg->timestamp ? $msg->timestamp : time();
	$msg->format = $msg->format ? $msg->format : 1;
	
	$result = db_query("INSERT INTO {privatemsg} (author, recipient, subject, message, timestamp, newmsg, hostname, format) VALUES ('%d', '%d', '%s', '%s', '%d', '%d', '%s', '%d')", $msg->author, $msg->recipient, $msg->subject, $msg->message, $msg->timestamp, 1, $msg->hostname, $msg->format);
}
}

This function sends a message when fed an object with the right stuff. It's pretty simple. Might want to consider creating a special UID (like -1 or something) that gets listed as "author" to be used as "System".

moshe weitzman’s picture

nice feature ... would be easier to just let the msg be from a real UID. make the uid configurable by admin.

mindless’s picture

I closed this duplicate: #84866.

mindless’s picture

Version: 4.7.x-1.x-dev »
Assigned: Unassigned » mindless
Status: Active » Fixed

Feature added on DRUPAL-5 branch. Set it up in admin/settings/privatemsg.

Anonymous’s picture

Status: Fixed » Closed (fixed)