MyBB Community Forums

Full Version: Need to run a script when user logs in
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need this script to run only once at the time of login. Can someone tell me how to do this?

<script type="text/javascript">
if (confirm("Sign in to Instant Messenger?") )
{
newwindow=window.open('php121/php121im.php','name','height=500,width=240,left=20,top=20,toolbar=no,menubar=no,directori es=no,location=no,scrollbars=yes,status=no,resizable=yes,fullscreen=no'); if (window.focus) {newwindow.focus()};
}
</script>



Thanks!
DAStaten
Anybody? I just need that script to run when a user first logs on. I just don't know where to put it so that it will only run that one time. Any help is greatly appreciated.

Thanks.
It's very odd to get it to run automatically.

I'd suggest sticking a link next to the Buddy List or something, to open the page.


Your request is a little tricky.
Yeah, I know hehe. I already have the link next to the buddy list. But I'm afraid people won't realize that logging into the forum isn't enough to be able to be contacted by IM. You have to sign into IM as well as the board for people to be able to contact you. Otherwise, the board shows you online but IM doesn't. So I want to be able to give people the option to log onto IM as soon as they lgo onto the board.
Ok, I've given up on the alert box. I just want this window to open when a user first logs in. I know I can't directly open the window with member.php, but is there a workaround? Is there a template that only runs when first logging in? Can member.php call a new template on login where I can place this code? Something like that?

<script type="text/javascript">
window.open('php121/php121im.php','name','height=500,width=240,left=20,top=20,toolbar=no,menubar=no,directories=no,location=no,scrollbars=yes,status=no,resizable=yes,fullscreen=no');
</script>

Thanks in advance.