Log in

View Full Version : prefill user and title field in new pm


ukdalai
02-13-2012, 05:51 PM
hi all, im trying to prefill a pm template, where i can prefill the recipient with say 3 user_id's and the title.

tried to do it like this:


Code:
private.php?do=newpm&u=291&title=free-upgrade it did not work, private.php?do=newpm&u=291 is fine but to a single user i need to do it for 3 users and also the subject/title.

Any help would be great, i know it can be done as i have before, i just cant remember how.

Thanks
Craig

kh99
02-13-2012, 06:11 PM
You can do this:

private.php?do=newpm&userid[]=3&userid[]=1


but I don't see any way to set the title without a plugin.

ukdalai
02-13-2012, 07:00 PM
maybe a copy private.php with a query string $ in the value for title?

Craig

kh99
02-13-2012, 07:06 PM
Well yes, you could also edit private.php.

ukdalai
02-13-2012, 07:30 PM
do you know what i would need to put, but i dont want it there for every pm, just links that i give to users.

Craig

kh99
02-13-2012, 07:41 PM
I think it should be:

$vbulletin->input->clean_gpc('r', 'title', TYPE_NOHTML);
$pm['title'] =& $vbulletin->GPC['title'];


If you're insterested in using a plugin you could try hook location private_newpm_start.

ukdalai
02-13-2012, 07:48 PM
sorry but vb coding im not too good with, are you saying if i add that i should be able to use title in a querystring, the recipient is fine now, i just need to be able to pass a link like:


private.php?do=newpm&userid[]=1&userid[]=2&userid[]=3&title=Free-Upgrade


im not sure if your code will allow that.

Craig

kh99
02-13-2012, 08:02 PM
sorry but vb coding im not too good with, are you saying if i add that i should be able to use title in a querystring,

Did you try it? I haven't, but I think it should work.

ukdalai
02-13-2012, 08:46 PM
should i just add those 2 lines of code to private.php
tried it and got: Fatal error: Call to a member function clean_gpc() on a non-object in
Craig

kh99
02-13-2012, 08:55 PM
Where did you put it? If you're going to insert it in the file it should be in the section that starts with

// ############################### start new pm ###############################
// form for creating a new private message
if ($_REQUEST['do'] == 'newpm')
{

ukdalai
02-13-2012, 09:12 PM
ive put it right after the {

now im not getting an error, but where the title is it now puts in " array"

Craig

--------------- Added 1329171270 at 1329171270 ---------------

its ok, it was my bad link, i had &title[]=hello not title=hello.

thankyou for your help, that has sorted it.

if theres nothing in the url, it should be blank right.
ill try it
Craig