The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

PM link - Autofill subject

3 posters

Go down

PM link - Autofill subject Empty PM link - Autofill subject

Post by TMartin3000 June 3rd 2012, 3:17 pm

I'd like to request a little help here, if I may.

Now, it's possible to create a link that would open the PM window to send a message to a certain user, but is it possible to create a link that automatically fills the subject of the PM, too?

For example, when a link directs to this URL: http://www.thesonicfamily.com/privmsg?mode=post&u=4, it opens the "Send Private Message" window (for the person who's already registered and logged in on the forum) to send a PM to user #4 (that's what u=4 stands for in the link), but is it possible to add further parameters to the URL, such as the subject of the message being composed? I tried adding "&subject=Text", but it didn't work. Is there any way to do this?
TMartin3000
TMartin3000
New Member

Male Posts : 1
Reputation : 1
Language : English, German, Hungarian

http://tsfsonicfamily.forumotion.com

Back to top Go down

PM link - Autofill subject Empty Re: PM link - Autofill subject

Post by c3vietk June 3rd 2012, 4:14 pm

Try this script :
Code:
$(function(){
   if (GetParam("mode") + GetParam("u") == "post4") $("input[name='subject']").val("TEXT");
});
c3vietk
c3vietk
Forumember

Male Posts : 65
Reputation : 41
Language : Vietnamese, HTML, Javascript, C#, PHP
Location : Vietnam, HCMc

http://diendan.chinhphuc.info/

Back to top Go down

PM link - Autofill subject Empty Re: PM link - Autofill subject

Post by LGforum June 4th 2012, 10:48 pm

No, there's no parameter for filling the subject field.

You could try something like this:
Code:

$(function(){
 var form = document.post;
 if(form && form.mode == 'post' && form.action == '/privmsg') {
    if(document.getElementById('username').value == 'USERNAMEOFPERSON') {
        form.subject.value = 'SUBJECT HERE';
  }
 }
});

Or you could try the post above, but I doubt it will work because you'd need the function getParam().
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

PM link - Autofill subject Empty Re: PM link - Autofill subject

Post by c3vietk June 5th 2012, 2:25 am

i have checked it.

the function is available in https://illiweb.com/rs3/33/frm/lang/notutf8-en.js
c3vietk
c3vietk
Forumember

Male Posts : 65
Reputation : 41
Language : Vietnamese, HTML, Javascript, C#, PHP
Location : Vietnam, HCMc

http://diendan.chinhphuc.info/

Back to top Go down

PM link - Autofill subject Empty Re: PM link - Autofill subject

Post by LGforum June 5th 2012, 2:30 am

I wouldn't say it's available in phpbb3 then. Use a console, getParam is undefined. So can't be used as a function.
LGforum
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum