View Full Version : Clicking on reply adding text
yukirina
06-17-2014, 02:47 AM
I've been trying to do this for a while, but is it possible to add a username of the person you're replying to in the quick reply box when you click on "reply"? No, this isn't quoting. I just want raw text of the username of the post you're replying to. This is what I'm hoping for:
User Bob posts a message on a thread.
User Charlie replies to Bob using "reply". The quick reply box shows right beneath. Normally it's empty, but in my case it should say:
[Bob ]
Without the brackets, but with the space.
I've been looking for what the template would give me and I believe this is the snippet that's relevant:
<vb:if condition="$show['quickreply'] AND !$show['threadedmode']">
<a id="qr_{vb:raw post.postid}" class='quickreply' href="{vb:raw post.replylink}&noquote=1" rel="nofollow" title="{vb:rawphrase quick_reply_to_this_message}"><img id="replyimg_{vb:raw post.postid}" src="{vb:raw vboptions.cleargifurl}" alt="{vb:rawphrase quick_reply_to_this_message}" /> {vb:rawphrase reply}</a>
<span class="seperator"> </span>
</vb:if>
The question is vb:raw post.replylink. I can't seem to find where this is. I don't think I should edit that though, and instead work on a different variable instead (since I want "reply with quote" to still function as needed and it also seems to use the same raw variable).
Any suggestions and help?
I don't think you're going to be able to do that by editing a template. I think how it works is that when you click the quick reply button, some javascript creates an instance of the editor and displays it under the post. Of course it's possible to put some initial text in the editor, but I think you'd probably have to add or modify javascript to do it.
yukirina
06-21-2014, 05:26 PM
What javascript would I have to edit?
CAG CheechDogg
06-22-2014, 07:57 AM
Wouldn't this do what you are asking for ....
https://vborg.vbsupport.ru/showthread.php?t=287620
tbworld
06-22-2014, 09:16 AM
Temporarily Reserved
Wouldn't this do what you are asking for ....
https://vborg.vbsupport.ru/showthread.php?t=287620
That doesn't seem to put the name in the editor text area, it seems like that puts it in the title when the post is displayed. But yeah, maybe that will solve yukirina's problem.
BTW, to answer the above question I don't know what javascript to change, I'm only assuming it could be done somehow.
yukirina
06-22-2014, 11:01 PM
Wouldn't this do what you are asking for ....
https://vborg.vbsupport.ru/showthread.php?t=287620
No, this isn't exactly what I want. This just replaces the display of the postbit with replacement text, when I actually want that text to be part of the database, as in, that text should be editable as well. But it's close!
Edit: I looked around and found a mod that has a skeleton of what I want, but I don't know how to make use of it. This is from vBulletin 3 so I can't use it (I use 4.2.2), nor do I really want to, as this is not what I'm looking for. But this mod allows you to select one of the "canned replies" you wrote which will instantly write it out. I think that's what it does. This seems to be the relevant portion of the XML that I opened up:
<plugins>
<plugin active="1" executionorder="5">
<title>Canned Replies</title>
<hookname>global_start</hookname>
<phpcode><![CDATA[if ($permissions['cannedreplies'] & $vbulletin->bf_ugp['cannedreplies']['canusecr']) {
if (THIS_SCRIPT == 'newreply' OR THIS_SCRIPT == 'newthread' OR THIS_SCRIPT == 'infraction' OR THIS_SCRIPT == 'private' OR THIS_SCRIPT == 'showthread') {
$userid = $vbulletin->userinfo['userid'];
$crtest .= "$vbphrase[cannedreplies]: <br />";
$crtest .= "<select onchange=\"insertAtCaret(this.options[this.selectedIndex].value)\">";
$crtest .= "<option value=\"\"></option>";
$crs = $db->query_read("SELECT id, title, reply FROM " . TABLE_PREFIX . "cannedreplies WHERE userid=$userid || reply LIKE '{share}%' || reply LIKE '{share}%' ORDER BY title ASC");
while($row = $db->fetch_array($crs)) {
$row[reply] = preg_replace("#(\r\n|\n|\r)#s", "\r\n <br>", addslashes($row[reply]));
$row[reply] = str_replace('\"', '"', $row[reply]);
$row[reply] = str_replace("\'", ''', $row[reply]);
$crtest .= "<option value=\"$row[reply]\">$row[title]</option>";
}
$crtest .= "</select>";
} }]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Canned Replies Javascript AutoInsert</title>
<hookname>parse_templates</hookname>
<phpcode><![CDATA[if ($permissions['cannedreplies'] & $vbulletin->bf_ugp['cannedreplies']['canusecr']) {
if (THIS_SCRIPT == 'newreply' OR THIS_SCRIPT == 'newthread' OR THIS_SCRIPT == 'infraction' OR THIS_SCRIPT == 'private' OR THIS_SCRIPT == 'showthread') {
if (THIS_SCRIPT == 'showthread') {
$editorid = "vB_Editor_QR";
} else {
$editorid = "vB_Editor_001";
}
eval('$crjs = "' . fetch_template('cr_js') . '";');
$vbulletin->templatecache['pm_newpm'] = str_replace('<form', '$crjs <form', $vbulletin->templatecache['pm_newpm']);
$vbulletin->templatecache['newthread'] = str_replace('</head>', '$crjs </head>', $vbulletin->templatecache['newthread']);
$vbulletin->templatecache['newreply'] = str_replace('</head>', '$crjs </head>', $vbulletin->templatecache['newreply']);
$vbulletin->templatecache['userinfraction'] = str_replace('</head>', '$crjs </head>', $vbulletin->templatecache['userinfraction']);
$vbulletin->templatecache['SHOWTHREAD'] = str_replace('</head>', '$crjs </head>', $vbulletin->templatecache['SHOWTHREAD']);
} }]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Parser</title>
<hookname>parse_templates</hookname>
<phpcode><![CDATA[if ($permissions['cannedreplies'] & $vbulletin->bf_ugp['cannedreplies']['canusecr']) {
if (THIS_SCRIPT == 'profile' OR THIS_SCRIPT == 'private' OR THIS_SCRIPT == 'usercp') {
$cannedreplieslink = "<tr><td class=\"alt2\" nowrap=\"nowrap\"><a class=\"smallfont\" href=\"cannedreplies.php?$session[sessionurl]\">Edit Your $vbphrase[cannedreplies]</a></td></tr>";
$vbulletin->templatecache['USERCP_SHELL'] = str_replace('$vbphrase[edit_ignore_list]</a></td></tr>','$vbphrase[edit_ignore_list]</a></td></tr>$cannedreplieslink',$vbulletin->templatecache['USERCP_SHELL']); }
}]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>Parser 2</title>
<hookname>parse_templates</hookname>
<phpcode><![CDATA[if ($permissions['cannedreplies'] & $vbulletin->bf_ugp['cannedreplies']['canusecr']) {
if (THIS_SCRIPT == 'newreply' OR THIS_SCRIPT == 'newthread' OR THIS_SCRIPT == 'infraction' OR THIS_SCRIPT == 'private' OR THIS_SCRIPT == 'showthread') {
$crdd = "<div class=\"smallfont\"> $crtest </div><br />";
$vbulletin->templatecache['pm_newpm'] = str_replace('<!-- / subject field -->', '<!-- / subject field -->$crdd', $vbulletin->templatecache['pm_newpm']);
$vbulletin->templatecache['newthread'] = str_replace('<!-- / subject field -->', '<!-- / subject field -->$crdd', $vbulletin->templatecache['newthread']);
$vbulletin->templatecache['newreply'] = str_replace('<!-- / subject field -->', '<!-- / subject field -->$crdd', $vbulletin->templatecache['newreply']);
$vbulletin->templatecache['userinfraction'] = str_replace('<!-- / note field -->', '<!-- / note field --> $crdd', $vbulletin->templatecache['userinfraction']);
$vbulletin->templatecache['SHOWTHREAD'] = str_replace('$vbphrase[message]', '$crdd $vbphrase[message]', $vbulletin->templatecache['SHOWTHREAD']);
} }]]></phpcode>
</plugin>
</plugins>
Not sure if this will help but I think answer lies in here somewhere!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.