View Full Version : Profile Enhancements - Ajax Reply to Visitor Message from your Own Profile
CCV_Pinto
11-29-2008, 10:00 PM
I will present you a modification I did to my own forum (http://forum.ccvteam.com):
You can reply to your visitor messages from your own profile.
I didnt create a plugin, so you will need to do 2 simple templates modifications and upload 2 files.
Installation
1. Upload the files to a folder "visitorReply" (you must create it) inside your forum folder (there is a success message in the visitorReply.js file, that you should translate to your own language)
2. Edit the template MEMBERINFO:
Find:
</head>
and add before it:
<!-- ccv modification -->
<script type="text/javascript" src="visitorReply/visitorReply.js"></script>
<!-- ccv modification -->
3. Edit the template memberinfo_visitormessage:
Find:
<ul class="list_no_decoration controls">
and add after it:
<!-- ccv modification -->
<if condition="$bbuserinfo[userid] == $userinfo[userid] && THIS_SCRIPT == 'member'">
<li class="smallfont"><a name="#link$message[vmid]" id="#link$message[vmid]" href="#link$message[vmid]" title="Reply" onclick="openVisitorReply($message[vmid], $message[postuserid], $userinfo[userid], '$bbuserinfo[securitytoken]', $bbuserinfo[userid])">Reply</a></li>
</if>
<!-- ccv modification -->
and add this code to the end of the template:
<!-- ccv modification -->
<div id="$message[vmid]"></div>
<!-- ccv modification -->
I will try to support, you can find me at my forum too. I speak english (not very well, but i think its understandable :D), french and portuguese.
I have just started to use it on my forums now, so its beta :D (beta is the fashion word of the moment)
And, because the template visitormessage has already an external form (inline moderation of the messages), i had to put the reply form into an inframe.
And I dont know how to use the vbulletin ajax, so I made it from my own ajax mode :D
regards
codershark
11-30-2008, 09:49 AM
Nice Hack I hope you will modified it :/
CCV_Pinto
11-30-2008, 08:43 PM
I updated the files... now its purely ajax!
my next step is make it a product
regards
Nice hack, can't wait until it's a product.
Nadeemjp
12-01-2008, 12:12 AM
it is a very fine hack indeed.
i am not a software guy, so editing of templates is not something i am comfortable with:D
so i shall wait for this hack to become a product.
cant wait man, hurry up :D
codershark
12-01-2008, 07:18 AM
Where I can see the Reply ? After I had reply to a message I cant see the reply anywhere :(
sinucello
12-01-2008, 07:21 AM
Good idea and useful. I often get visitor messages reported when users try to answer them. Should be a core feature.
CCV_Pinto
12-01-2008, 08:11 AM
Where I can see the Reply ? After I had reply to a message I cant see the reply anywhere :(
I am not sure if I understood the question, but if you reply to a message from user "John", then you should see the message at his profile
I will try to make a product this week, I started playing with it this weekend but I didnt have sucess :(
no prob, I will get there ;)
Leo Brazil
12-01-2008, 09:57 AM
Obrigado CCV e força Verdão !!
Thanks CCV, good idea.
codershark
12-01-2008, 10:08 AM
sorry but I cant find the reply in the other profile :(
CCV_Pinto
12-01-2008, 12:01 PM
sorry but I cant find the reply in the other profile :(
can you send a link to your board, so I can test?
ps: boa Leo, sabia q a torcida palmeirense ia gostar ;)
rainyleaves
12-01-2008, 01:24 PM
Awesome!!!! Thanks, CCV.
MOTM!
CCV_Rugopix
12-01-2008, 02:14 PM
good job pinto ^^
NAZIA
12-02-2008, 11:27 AM
let me test...
Thanks for this idea..
I wish.It should be built in with VB..
NAZIA
01-19-2009, 05:32 PM
Working perfect for me...
yotsume
08-29-2009, 06:57 AM
So when can you have a product done? :) PLEASE!!! :)
yotsume
08-29-2009, 07:15 AM
QUESTION:
How can we get the basic editor to display when making the replies? We need at least the basic editor buttons. It would be nice to also have a go advanced button as well.
SUGGESTION:
You need to make a cancel button that closes the ajax! If you decide not to type a reply and you want to make another reply you will get multiple opened message windows.
You need to have the message background be a little gray. How can I change the background of the message text area?
Great idea please keep developing this!
CCV_Pinto
09-06-2009, 05:27 AM
1 - the basic editor buttons would be a nice feature, I would have to investigate it a litle. The button to advanced mode i think is easy to implement (I would need just to copy the code from the template to my visitorReply.php)
2 - to create a cancel button, you can add this to the step 3 (inside the if, after the first li tag , I didnt test it, but its simple, it should work):
<li class="smallfont"><a href="#link$message[vmid]" title="Close" onclick="document.getElementById($message[vmid]).style.display = 'none'">Close</a></li>
you will also need to change the openVisitorReply to inside the javascript file to:
function openVisitorReply(id, user, user2, securitytoken, userid) {
if(document.getElementById(id) != null){
document.getElementById(id).innerHTML = "<iframe name=\"iframe"+id+"\" scrolling=\"no\" align='center' style=\"border: 0;\" id=\"iframe"+id+"\" src=\"./visitorReply/visitorReply.php?u="+user+"&u2="+user2+"&securitytoken="+securitytoken+"&userid="+userid+"&id="+id+"\" width=\"100%\" height=\"100\"></iframe>";
document.getElementById($message[vmid]).style.display = 'block';
}
}
3 - the text area little gray you need to set the background color of the textarea inside the visitorReply.php file
style="background:#COLORHERE"
If I have same time I will update this... but I think I wont make it a product, because it already took me a few hours trying it...
yotsume
09-06-2009, 08:29 AM
I am looking forward to the update!
I will try your suggested edits and report back.
THANKS!
yotsume
09-06-2009, 09:03 AM
I tried your suggested edits to get the Close button. A few things:
Your edits are for a close link and it is in the wrong place. It should be a button and located to the right of the Reply button once the window pops open.
So the Close link should be a button that would be better labeled as "Cancel" and located just to the right of the Rely button not the link at the bottom of the popup.
The Close link should not show when there is nothing opened yet. ;)A Small Issue:
Once you click "Close" if you decide to reply to that same message you can't. The window will not pop open a second time.
After you click "Close" the only way to reopen the same message if you wanted to reply and changed your mind is to refresh the whole page. YUCK
How can this be fixed?Thanks for the edits. A broken close is better then no close. :)
giri1991
12-05-2009, 03:48 PM
Anyway to get the character limit off ? I tried editing the visitorReply.jsx file but didnt seem to work :(
vijayninel
04-20-2010, 10:48 AM
Giving me a invalid security token error on a newly created default vb style in 3.8.4 :(
inciarco
07-03-2010, 06:15 PM
Works Fine on vB384.
2 Things. (All Credit to "CCV_Pinto" for Sharing the Code a Few Posts Above).
1. You Should Set Usergroup Permissions because the Code Doesn't Control Posting Flood, so this should be Thrusted Only to High Level Members.
2. The Following Code Makes it Work With the "Close" Button and Adds a "Full Reply" Link.
2.1
On "visitorReply.js:
Add
document.getElementById(id).style.display = 'block';
Immediately Below
function openVisitorReply(id, user, user2, securitytoken, userid) {
so that it is:
function openVisitorReply(id, user, user2, securitytoken, userid) {
document.getElementById(id).style.display = 'block';
if(document.getElementById(id) != null)
document.getElementById(id).innerHTML = "<iframe name=\"iframe"+id+"\" scrolling=\"no\" align='center' style=\"border: 0;\" id=\"iframe"+id+"\" src=\"./visitorquickreply/visitorReply.php?u="+user+"&u2="+user2+"&securitytoken="+securitytoken+"&userid="+userid+"&id="+id+"\" width=\"100%\" height=\"100\"></iframe>";
}
2.2
On memberinfo_visitormessage Template, change this part of the Initial Instructions:
Below
<ul class="list_no_decoration controls">
Add
<!-- ccv modification -->
<if condition="$bbuserinfo[userid] == $userinfo[userid] && THIS_SCRIPT == 'member'">
<li class="smallfont"><a name="#link$message[vmid]" id="#link$message[vmid]" href="#link$message[vmid]" title="Quick Reply" onclick="openVisitorReply($message[vmid], $message[postuserid], $userinfo[userid], '$bbuserinfo[securitytoken]', $bbuserinfo[userid])">Quick Reply</a></li>
<li class="smallfont"><a href="#link$message[vmid]" title="Close" onclick="closeVisitorReply($message[vmid])">Close</a></li>
</if>
<li class="smallfont"><a href="visitormessage.php?u=$message[postuserid]&do=message" title="Full Reply">Full Reply</a></li>
<!-- ccv modification -->
This Creates the New Link for "Full Reply" and also the "Close" Button for the "Quick Reply".
If you'd like to Add Usergroup Permissions, then the Code on memberinfo_visitormessage Template should be:
<!-- ccv modification -->
<if condition="($bbuserinfo[userid] == $userinfo[userid] && THIS_SCRIPT == 'member') AND in_array($bbuserinfo[usergroupid], array(5,6,7))">
<li class="smallfont"><a name="#link$message[vmid]" id="#link$message[vmid]" href="#link$message[vmid]" title="Quick Reply" onclick="openVisitorReply($message[vmid], $message[postuserid], $userinfo[userid], '$bbuserinfo[securitytoken]', $bbuserinfo[userid])">Quick Reply</a></li>
<li class="smallfont"><a href="#link$message[vmid]" title="Close" onclick="closeVisitorReply($message[vmid])">Close</a></li>
</if>
<li class="smallfont"><a href="visitormessage.php?u=$message[postuserid]&do=message" title="Full Reply">Full Reply</a></li>
<!-- ccv modification -->
Notice the "($bbuserinfo[userid] == $userinfo[userid] && THIS_SCRIPT == 'member') AND in_array($bbuserinfo[usergroupid], array(5,6,7)"; you should change the 5,6,7 to the Usergroups You'd Like to Allow to Use the Quick Reply.
Notice that the "Full Reply" Link is Out of the "if" Conditional; if you'd like to Condition the Display of it only to Member Profile Owner and Allowed Usergroups then move that line Above the "</if>".
<li class="smallfont"><a href="visitormessage.php?u=$message[postuserid]&do=message" title="Full Reply">Full Reply</a></li>
My Best Regards and Appreciation to CCV_Pinto for sharing this Interesting Code; I Hope You Can Include for a Future Update the Flood Control so that No Excesive Visitor Messages can be Posted.
:)
Gursimran
09-14-2010, 05:53 PM
what about vB4?
W!cKeD
11-09-2010, 02:59 PM
what about vB4?
Yeah.. please update it ;) its a nice addon.
bigs15
10-17-2012, 09:25 PM
This code is modified by me for close tag use this :)
<li class="smallfont"><a name="#link$message[vmid]" id="#link$message[vmid]" href="#link$message[vmid]" title="Close" onclick="closeVisitorReply($message[vmid], $message[postuserid], $userinfo[userid], '$bbuserinfo[securitytoken]', $bbuserinfo[userid])">Close</a></li>
jowshany
09-23-2014, 09:09 AM
vb4?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.