Creating PM Links

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
User avatar
Tnias
Registered User
Posts: 81
Joined: Tue Apr 11, 2006 10:37 am
Location: Colorado
Contact:

Creating PM Links

Post by Tnias »

On our sites we use hyperlinks to launch a private message compose window with the "To" field pre-populated. The links look like this:
https://teamlawforum.net/ucp.php?i=pm&mode=compose&u=2

We are wondering whether there is a way to pre-populate more than one user in the "To" field and whether there is a way to also pre-populate the "Subject" field.

Such abilities would be extremely helpful.
Tnias.

"In memory of our God, our faith, and freedom,
and of our spouses, our children, and our peace."
User avatar
AmigoJack
Registered User
Posts: 6106
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Creating PM Links

Post by AmigoJack »

Sure it is possible. Of course the parameters have to be URI encoded, so let me display it with one parameter per line, plus decoded text in the middle and more explanation on the right side:

Code: Select all

https://teamlawforum.net/ucp.php?
i=pm&                              (the module we access)
mode=compose&                      (the module's mode)
address_list%5bu%5d%5b3241%5d=to&  = address_list[u][3241]=to  = user #3241 as recipient
address_list%5bu%5d%5b5510%5d=to&  = address_list[u][5510]=to  = user #5510 as recipient
address_list%5bu%5d%5b2%5d=bcc&    = address_list[u][2]=bcc    = user #2 in blind carbon copy
address_list%5bg%5d%5b4%5d=to&     = address_list[g][4]=to     = group #4 as recipient
subject=My%20new%20PM&             = My new PM
add_to=1                           (needed to accept a subject at all)
Partly tested on this very board.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
Tnias
Registered User
Posts: 81
Joined: Tue Apr 11, 2006 10:37 am
Location: Colorado
Contact:

Re: Creating PM Links

Post by Tnias »

Thanks.
From your reply we figured out that if we enter the code:

Code: Select all

https://{SiteAddress}/ucp.php?i=pm&mode=compose&u={Recipient1}&u={Recipient2}&add_to=1&subject=C2A
We expected to open a compose window on our board with "Recipient" and "BCC" fields pre-populated and the Subject: C2A.

What we got was a compose window opened where the second "u={Recipient2}" in the code defined the Recipient field; but there was no BCC field showing. The subject was pre-populated with: "Subject: C2A".

So, thanks for helping learn how to pre-populate the subject field.

Remaining question: What inline code do we use (instead of using "u=" twice) to pre-populate the BCC field in the Compose window?
In the following code, where: {???} is the code needed to pre-populate the BCC field, can you clarify what the inline code is to pre-populate the Compose window's BCC field:

Code: Select all

https://{SiteAddress}/ucp.php?i=pm&mode=compose&u={Recipient}&{???}={BCC}&add_to=1&subject={Subject}
Also, is it possible to pre-populate the message field with an inline code?

Thanks for any help available to resolve this.
Tnias.

"In memory of our God, our faith, and freedom,
and of our spouses, our children, and our peace."
User avatar
AmigoJack
Registered User
Posts: 6106
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Creating PM Links

Post by AmigoJack »

That would be the address_list%5bu%5d%5b2%5d=bcc parameter=value pair where 2 is the recipient, just like I already wrote it in the 6th line of the code box. No idea why you insist on u= which is a dead end anyway. How about using the full URI I presented right away without modifying it?
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
Tnias
Registered User
Posts: 81
Joined: Tue Apr 11, 2006 10:37 am
Location: Colorado
Contact:

Re: Creating PM Links

Post by Tnias »

Thank you so much Amigo Jack. Your assistance was awesome!
I tried the full url code you suggested and it worked perfectly!

The reason we continued to use the "u=" is: that is what the phpBB software uses when you click on the Members profile page link at: "PM: Send private message"; and, we knew that works. Respectively, I didn't fully understand that the lines you sent were the full url for the answers we requested.

Please forgive my ignorance and thanks for setting me straight on that!

We are still curious whether there is a code solution for pre-populating the content of the actual message in a Compose window when it opens. There has to be a way because, when a message is received, if you want that message quoted in your reply, you select the quote icon and the message you received is pre-populated in the reply compose window. We are curious whether such message pre-population can be done with a code sequence in the url command line; similar to what you just showed us with the recipient, BCC & subject.

Is it possible? Can you (or anyone) help us with that need?
Tnias.

"In memory of our God, our faith, and freedom,
and of our spouses, our children, and our peace."
User avatar
AmigoJack
Registered User
Posts: 6106
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Creating PM Links

Post by AmigoJack »

Tnias wrote: Mon Jan 24, 2022 8:25 pmpre-populating the content of the actual message in a Compose window
That would be the action=quote&p=2285411 parameters to quote from a PM, refered to by p. However, to quote from a post it would be action=quotepost&p=15803921, refering to the post by p. As you can see in both cases no actual text is given.
Tnias wrote: Mon Jan 24, 2022 8:25 pmwhether such message pre-population can be done with a code sequence in the url
To not quote an existing post or PM but still pre-filling a PM text you could add the message=My%20text parameter when using my full example (needs the add_to=1 parameter).
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
Tnias
Registered User
Posts: 81
Joined: Tue Apr 11, 2006 10:37 am
Location: Colorado
Contact:

Re: Creating PM Links

Post by Tnias »

Awesome!
Thank you! Thank you! Thank you!
That makes using our system so much better.

I have a final question regarding this kind of information.
Is there a resource (book, etc.) we can use a reference for learning more about what's available to us from the url command line (options etc.).

Again Thank you AmigoJack ; your help was awesome and on -point.
Tnias.

"In memory of our God, our faith, and freedom,
and of our spouses, our children, and our peace."
User avatar
AmigoJack
Registered User
Posts: 6106
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: Creating PM Links

Post by AmigoJack »

No, such a book/tutorial does not exist. You need:
  • to use correct terms (it's not a "command line", just a URI/address). If you synonymize too much you'll never be able to tell things apart.
  • to be able to distinguish: what's the URI, how much is HTTP involved, and where's phpBB's part.
  • to master multiple topics - one alone is by far not enough. In this case it would be:
    • HTTP to understand in general what a GET/POST is, and per that
    • URIs with their URL syntax and parameter encodings.
    • A bit of HTML understanding helps, too, to judge from the forms which parameters are sent how. However, this is almost optional.
    • PHP to read phpBB's code (so you're able to tell which file to open and how parameters are processed), as well as
    • phpBB itself as good as you can - if you're still unsure how to compose a PM and from which parts this can be achieved then it's pointless to mix in all the other details - that would just confuse you even more.
To capture HTTP (or HTTPS) traffic which let you analyze each HTTP's request and response you could use i.e. Wireshark. But it also requires experience and doesn't spoon feed it to you either - you still have to take control over it.

In other words: it's combining multiple topics that you have understood well and experienced for a while.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
Tnias
Registered User
Posts: 81
Joined: Tue Apr 11, 2006 10:37 am
Location: Colorado
Contact:

Re: Creating PM Links

Post by Tnias »

Again, thanks for sharing. I expected as much; but, still, had to ask.
I checked out Wireshark. Thanks! I started using it and taking their masterclass trainings to learn how to use that software. It's incredible.
Tnias.

"In memory of our God, our faith, and freedom,
and of our spouses, our children, and our peace."
Post Reply

Return to “phpBB Custom Coding”