The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Pre-filling the Recipient Box in newpm based on {option} in a bbcode.
Hi there,
I am attempting to trouble-shoot a custom bbcode for my forum which would pre-fill the recipient box of the "newpm" page with the userid of the user which featured in the {option} part of the custom bbcode. The code is designed to use {option} to determine which profile to link to, and it does this, but we seem to have struck an issue in getting it to pre-fill the recipient box in the newpm page. We appear to need the userid for this, but as I'm not sure on how to get it - it will be different for every user which uses the code. Such as: admin=admin1, admin=admin2 etc Is there a way to convert the username of a poster (the contents of {option} in this case) to its userid so it'd work with the newpm page? The specific line of code we're not sure about is this: (We've added the ____ as a placeholder) Code:
<a href="http://www.alexandria-ns.com/private.php?do=newpm&_____"><img src="http://www.alexandria-ns.com/images/misc/message.png" alt="Send a PM?"></a> ~ProfC Full code: Code:
<table cellspacing="0" style="border: solid #003399 1px; border-left: 0; width: 700px; background-color: #FFFFFF;"><tr><td style="width: 190px; border-left: solid #003399 4px; padding: 10px 15px; background-color: #003399; border-right: solid #003399 4px; border-top: solid #003399 1px; border-bottom: solid #003399 1px;" valign="top"> <h1 style="margin: 0; padding: 0;font-size: 11pt; font-weight: normal;"><a href="http://www.alexandria-ns.com/member.php?do=getinfo&username={option}" target="_blank" onclick="javascript<b></b>:window.open(this.href, 'Profile of: {option}, 'width=800,height=400,resizable=yes, menubar=yes, scrollbars=yes, status=yes, toolbar=yes'); return false;" style="color: #e3dc0b;"><b>{option}</b></a></h1><p style="margin: 0; padding: 0;color: #e3dc0b; font-size: 8pt; padding: 3px 0;">Administrator's Comment</p><div style="margin-top: 10px;"></div><br><a href="http://www.alexandria-ns.com/private.php?do=newpm&_____"><img src="http://www.alexandria-ns.com/images/misc/message.png" alt="Send a PM?"></a> </td><td style="width: 440px; padding: 10px 15px; font-size: 8pt; border-right: solid #003399 4px; border-top: solid #003399 1px; border-bottom: solid #003399 1px;" valign="top"><b>{param}</b></td></tr></table> |
#2
|
|||
|
|||
I think member.php takes either &username=... or &userid=..., so maybe that would solve the problem.
|
#3
|
||||
|
||||
Quote:
As for "&userid=" I'm currently lost on how to link it to the username given in {option}. As vBulletin appears to use the userid to define the recipient when you click "Send PM" from their profile. Screenshot: http://gyazo.com/322334da18a8c5cc915e5d6200c705a2 (Sorry for not posting one in sooner) |
#4
|
|||
|
|||
I guess I was thinking that you could change the bbcode to take userid as the option, then use that in the profile link, but I guess you don't want to do that (I guess if a user is entering it then they don't want to have to look up the userid).
So what you could do is create a plugin using hook location private_newpm_blank and code like this: Code:
$vbulletin->input->clean_gpc('r', 'username', TYPE_STRING); if ($vbulletin->GPC['username'] != '') { // validate username if ($user = $db->query_first_slave("SELECT userid FROM " . TABLE_PREFIX . "user WHERE username = '" . $db->escape_string($vbulletin->GPC['username']) . "'")) { if (empty($pm['recipients'])) $pm['recipients']= $vbulletin->GPC['username']; else $pm['recipients'] .= ' ; '.$vbulletin->GPC['username']; } } I haven't tested it but it looks like it should work. |
Благодарность от: | ||
ProfC |
#5
|
||||
|
||||
That works perfectly, thank you so much.
|
#6
|
|||
|
|||
If I understand your question, this already exists in vB.
Code:
http://www.website.com/forums/private.php?do=newpm&u[]=1&u[]=2&u[]=3&u[]=4&u[]=5 |
#7
|
||||
|
||||
Quote:
http://gyazo.com/322334da18a8c5cc915e5d6200c705a2 The plugin code given to me by kh99 has sorted the matter and made me kick myself for not posting sooner. Much simpler and more straightforward than any option I've been looking at. |
Благодарность от: | ||
CoffeeLovesYou |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|