Who is online?
In total there are 3 users online :: 0 Registered, 0 Hidden and 3 Guests :: 1 BotNone
Most users ever online was 246 on Tue 31 Jan - 2:47
Statistics
We have 150 registered usersThe newest registered user is Luxic
Our users have posted a total of 2050 messages in 200 subjects
Latest topics
» A small shareby Flora Today at 21:03
» Edit the 404 page on Forumotion
by LGforum Today at 15:29
» How to Change The Homepage?
by LGforum Today at 15:28
» Counter for my notices box
by Niko Today at 15:03
» 21. Show Recent Topics Preview In Accordion
by ReBoRN Yesterday at 19:08
15. Visitor Message Notifications
Page 1 of 2 • Share •
Page 1 of 2 • 1, 2 
15. Visitor Message Notifications
15. Visitor Message Notifications
(for phpbb3 and invision, it might work in other versions... I didn't check)
- Example in the top left corner.
PLEASE NOTE: for this tutorial to work you must have installed this: http://www.diondesigns.org/t440-example-9-accessing-user-information-all-boards
That tutorial will create a global variable accessible to other scripts which contains the user id number.
UNLESS: if you have LGchat version 4 installed, you won't need to install the above link.
After doing so if not already installed... put this in a javascript file:
(i recommend putting this script ONLY FOR HOMEPAGE, NOT in all pages.)
And then this goes in your CSS to style it. Feel free to make it look more like your forum.
This script will provide you with a notification box in the top corner of the page when someone has posted a message on your wall (visitor messages).
It uses a similar technique to this forum, and will also grab the name of the person who has posted on your wall. (only the latest message)
Here's a screenshot of what it will look like:

I admit the styling is simple... but i reckon you'll like it when you see it on your page.
I understand a lot of forums don't use the visitors message feature much, but now with notifications, here's your chance to make use of this feature
(for phpbb3 and invision, it might work in other versions... I didn't check)
- Example in the top left corner.
PLEASE NOTE: for this tutorial to work you must have installed this: http://www.diondesigns.org/t440-example-9-accessing-user-information-all-boards
That tutorial will create a global variable accessible to other scripts which contains the user id number.
UNLESS: if you have LGchat version 4 installed, you won't need to install the above link.
After doing so if not already installed... put this in a javascript file:
(i recommend putting this script ONLY FOR HOMEPAGE, NOT in all pages.)
- Code:
var CopyrightNotice='Visitor Message Notification script for Forumotion Boards. Copyright © by LGforum. All Rights Reserved. Use and modification of this script is not allowed without this entire copyright notice in the original, copied, or modified script. No distribution without consent.';
function getvms(){
var a=new XMLHttpRequest();
a.onreadystatechange=function() {
if (a.readyState==4 && a.status==200) {
var x=a.responseText.indexOf('title="New message" /> by ');
if (x != -1) {
var c=a.responseText.substring(x,a.responseText.indexOf('</a>',x)+4);
var user=c.substring(26,c.length);
var html="<div id='LGnewVM'>Notification: '"+user+"' has left you a Visitor Message!<br><br><span onclick=\"document.getElementById('LGnewVM').style.display='none';\">Close</span></div>";
document.body.innerHTML+=html;
}
}
}; a.open("GET","/u" +uid+ "wall",true); a.send();
}
$(function(){ if (uid){ getvms(); } else { setTimeout('getvms();',1500); }});
And then this goes in your CSS to style it. Feel free to make it look more like your forum.
- Code:
#LGnewVM {
position: fixed;
top: 5px; right: 5px;
border: 2px solid #105289;
background: #fff;
border-radius: 6px;
font-size: 13px;
text-align: center;
padding: 10px;
}
#LGnewVM span {
border: 1px solid #000;
background: #CCC;
color: #000;
padding: 3px;
cursor: pointer;
}
#LGnewVM span:hover {
background: #666;
color: #fff;
}
This script will provide you with a notification box in the top corner of the page when someone has posted a message on your wall (visitor messages).
It uses a similar technique to this forum, and will also grab the name of the person who has posted on your wall. (only the latest message)
Here's a screenshot of what it will look like:

I admit the styling is simple... but i reckon you'll like it when you see it on your page.
I understand a lot of forums don't use the visitors message feature much, but now with notifications, here's your chance to make use of this feature
Notification: Admin has left you a Visitor Message!
|
Last edited by LGforum on Tue 17 Jan - 5:53; edited 11 times in total

LGforum- Forum Version: Phpbb3
Posts: 729
Join date: 2011-10-05
Location: UK

Re: 15. Visitor Message Notifications
Now This Is a nice Tutorial I tried it on phpBB2 and it don't seem to work which is a shame but I may now look into changing my forum over to phpBB3 

nutsonlizards- Forum Version: PunBB
Posts: 44
Join date: 2011-11-18
Re: 15. Visitor Message Notifications
This is definitely on my list to get done. 
Very nice tutorial, LG! Thank you!
Very nice tutorial, LG! Thank you!

Flora
Status: If you like gardening, please join my site. Ty. :)
Forum Version: Phpbb3
Posts: 151
Join date: 2011-11-18
Location: USA

Re: 15. Visitor Message Notifications
Make some for phpbb2 

pidot101
Status: . . .
Posts: 58
Join date: 2011-12-09
Age: 16
Re: 15. Visitor Message Notifications
LG, I installed this, but have since taken it off because I think I might have another script running that might be clashing with it. I just couldn't get it to show up when visitor messages tests were performed. (And yes, I did install LG Chat V4.0 prior to applying this.)
So, until I find what the problem is, I'll have to pass on this.
So, until I find what the problem is, I'll have to pass on this.

Flora
Status: If you like gardening, please join my site. Ty. :)
Forum Version: Phpbb3
Posts: 151
Join date: 2011-11-18
Location: USA

Re: 15. Visitor Message Notifications
its work on punbb?

Urbrohasan
Status: AVACWEB IS AWESOME
Forum Version: PunBB
Posts: 34
Join date: 2011-12-25
Age: 23
Location: Tamil nadu, India
Re: 15. Visitor Message Notifications
LGforum wrote:15. Visitor Message Notifications
(for phpbb3 and invision, it might work in other versions... I didn't check)
Not sure Urbrohasan. I have phpbb3, though you could try it out and let us know how it goes.

Flora
Status: If you like gardening, please join my site. Ty. :)
Forum Version: Phpbb3
Posts: 151
Join date: 2011-11-18
Location: USA

Re: 15. Visitor Message Notifications
Flora, the problem is, the UID variable needed from LGchat script for ths script to work, is only available after the LGchat Iframe loads. (which i forgot)
You'll likely have more luck though if you put the script within script tags and stick it underneath your LGchat HTML.
If still no luck i could take a look at your forum.
EDIT: You'll now see in the top left corner of this page an example notice. I'm going to be doing with this with my tutorials from now on... if possible and needed.
You'll likely have more luck though if you put the script within script tags and stick it underneath your LGchat HTML.
If still no luck i could take a look at your forum.
EDIT: You'll now see in the top left corner of this page an example notice. I'm going to be doing with this with my tutorials from now on... if possible and needed.

LGforum- Forum Version: Phpbb3
Posts: 729
Join date: 2011-10-05
Location: UK

Re: 15. Visitor Message Notifications
Ok LG. I'll give it another go. Thank you! 

Flora
Status: If you like gardening, please join my site. Ty. :)
Forum Version: Phpbb3
Posts: 151
Join date: 2011-11-18
Location: USA

Re: 15. Visitor Message Notifications
LGforum wrote:Flora, the problem is, the UID variable needed from LGchat script for ths script to work, is only available after the LGchat Iframe loads. (which i forgot)
You'll likely have more luck though if you put the script within script tags and stick it underneath your LGchat HTML.
If still no luck i could take a look at your forum.
EDIT: You'll now see in the top left corner of this page an example notice. I'm going to be doing with this with my tutorials from now on... if possible and needed.
Tried that, and it's still not working. Sorry.

Flora
Status: If you like gardening, please join my site. Ty. :)
Forum Version: Phpbb3
Posts: 151
Join date: 2011-11-18
Location: USA

Re: 15. Visitor Message Notifications
- Code:
EDIT: You'll now see in the top left corner of this page an example notice. I'm going to be doing with this with my tutorials from now on... if possible and needed.
cool idea
ion-cube
Status: Testing
Posts: 121
Join date: 2011-10-19
Age: 23
Location: Pakistan
Re: 15. Visitor Message Notifications
I have edited the code in this tutorial for users who were having problems with it.
From what I have seen the users who were having the problems were the users who were using LGchat and so not the installation provided in the link.
The problem is coming from the fact that the script needs the unique user id number and it can get that from the LGchat script. However, this script is often running before the LGchat script, and so before the user id number is available and thats where the problem is.
So i've edited it to contain this line:
Which will check if the user id is available, if it is it will run the function, if not then it will check again in a second. So as long as you either have the tutorial in the link installed or LGchat installed it should work fine now.
From what I have seen the users who were having the problems were the users who were using LGchat and so not the installation provided in the link.
The problem is coming from the fact that the script needs the unique user id number and it can get that from the LGchat script. However, this script is often running before the LGchat script, and so before the user id number is available and thats where the problem is.
So i've edited it to contain this line:
- Code:
$(function(){ if (uid != 'undefined'){ getvms(); } else { setTimeout('getvms();',1500); });
Which will check if the user id is available, if it is it will run the function, if not then it will check again in a second. So as long as you either have the tutorial in the link installed or LGchat installed it should work fine now.

LGforum- Forum Version: Phpbb3
Posts: 729
Join date: 2011-10-05
Location: UK

Re: 15. Visitor Message Notifications
I installed it again this afternoon. Nothing is conflicting with it as far as I can see. So I sent a VM, but have no notice of it yet, and not sure why.
I'll leave it as is so that you can see for yourself. Maybe we're missing something else? Not sure, but thank you for your help.
I'll leave it as is so that you can see for yourself. Maybe we're missing something else? Not sure, but thank you for your help.

Flora
Status: If you like gardening, please join my site. Ty. :)
Forum Version: Phpbb3
Posts: 151
Join date: 2011-11-18
Location: USA

Re: 15. Visitor Message Notifications
Apologies there was a tiny error. The script in the first post has been amended.

LGforum- Forum Version: Phpbb3
Posts: 729
Join date: 2011-10-05
Location: UK

Re: 15. Visitor Message Notifications
Well Iv worked it out I think lol I used Dion Accessing User Information and it working like a treat thx

nutsonlizards- Forum Version: PunBB
Posts: 44
Join date: 2011-11-18
Page 1 of 2 • 1, 2 
Page 1 of 2
Permissions in this forum:
You cannot reply to topics in this forum