I would like to have a "Guest Friendly Message" script, it is only viewable to guests, but when guests login or register the whole "Guest friendly message" table disappears. Now this is what I want:
http://i185.photobucket.com/albums/x20/magedesigns/misc/gues t_view.png
That is exactly how I want it. Plus the login will have its time to be logged in. As well as a <a href="/action/register">[register]</a> link. Above it.
It would be much appreciated.
(I would do this myself by I am having trouble I know some scripting but not that good.)
Thanks,
Darkmage
Darkmage, remember that code I PM'd you, why not code a table in the guest part and leave the member part blank?
o_0 I did not think of that. Thanks! I will try that. I forgot all about it.![]()
But what about the Login field? Some scripting needs to go into that.
edit:
Not working![]()
http://vfad.vforums.co.uk/
I put it in Global Header
I'm not saying this is exactly what you are looking for but something like this? I'm can edit it any way if needed:
Code:
- <script type="text/javascript">
- <!--
- /*
- Guest Friendly Message by Dwight
- Copyright© 2008 Infinity Codes
- http://icodes.vforums.co.uk
- Do not Repost
- */
- //Edit Below
- var wtp = 2; //0 = above banner, 1 = above menu buttons, 2 = below menu buttons
- //Edit Above
- function login(){
- get('username','name')[0].value = get('un','id').value;
- get('password','name')[0].value = get('pw','id').value;
- get('loginForm','name')[0].submit();
- }
- function build(){
- var wt = document.getElementById("welcome_table");
- var nRow=wt.insertRow(wtp);
- var nCell=nRow.insertCell(0);
- nCell.className="window1";
- nCell.innerHTML = 'We hope you enjoy your visit.<br /><br /><br />You’re currently viewing the our forum as a guest. This mean you are limited to certain areas of the board and there are some features you can not use. If you join our community, you’ll be able to access the member-only sections, and use many member-only features such as customizing your profile, sending private messages, and voting in polls. Registration is simple, fast, and completely free.<br /><br /><br /><font color="#FF6600">Join our community! <a href=/action/register>Register Now!</a></font><br /><br /><br />If you are already a member please login to your account to access all the features:<br /><form action=javascript:void(0); onsubmit=login();>Username: <input type="text" id="un" size="20"> Password: <input type="password" id="pw" size="20"><input type="submit" value="Login"></form>';
- }
- //-->
- </script>
- <script>
- if(location.href.match(/.co.uk($|\/$)/) && vf_username == 'guest'){
- build();
- get('loginForm','name')[0].firstChild.style.display = 'none';
- get('loginForm','name')[0].parentNode.previousSibling.style.display = 'none';
- get('loginForm','name')[0].parentNode.nextSibling.style.display = 'none';
- }
- </script>
I hope this is what you where looking for. I wasn't sure if you wanted the message in an another table or not so I just combined it into the welcome table, giving you the option of placing it either above the banner, or above or bellow the menu buttons.Should sound familiar. As well I took the base of the vb quick login code so it only shows for a guest. The only thing though is that it only shows on the main page, no where else, at least for now, though just by remove the
($|\/$)
from the
if(location.href.match(/.co.uk($|\/$)/)
you can make it show on every page, but I am currently working on getting it so that it will not show on the login page of the register page. Well I hope this works for you![]()
For a Preview, check the IFC test forum
Edit: I forgot to add that I am currently recoding it a bit to make it a bit easier to edit
Thanks DwightI can use this one until you get the other one fixed.
edit
But look what happens:
http://i185.photobucket.com/albums/x20/magedesigns/misc/vf_a d_preview.jpg
recopy the code above
Still the same.
OK here is the fixed version of the code, as well as the array:
Code:
- <script type="text/javascript">
- /*
- Guest Friendly Message by Dwight
- Copyright© 2008 Infinity Codes
- http://icodes.vforums.co.uk
- Do not Repost
- */
- //Edit Below
- var wtp = 2; //0 = above banner, 1 = above menu buttons, 2 = below menu buttons
- var message = ['We hope you enjoy your visit.<br /><br /><br />You re currently viewing the our forum as a guest. This mean you are limited to certain areas of the board and there are some features you can not use. If you join our community, you ll be able to access the member-only sections, and use many member-only features such as customizing your profile, sending private messages, and voting in polls. Registration is simple, fast, and completely free.<br /><br /><br /><font color="#FF6600">Join our community! <a href=/action/register>Register Now!</a></font><br /><br /><br />If you are already a member please login to your account to access all the features:']; // Do not use 's, they will cause the code to break.
- var form = ['<form action=javascript:void(0); onsubmit=login();>Username: <input type="text" id="un" size="20"> Password: <input type="password" id="pw" size="20"> <input type="submit" value="Login"></form>'];
- //Edit Above
- function build(){
- var wt = document.getElementById("welcome_table");
- var nRow=wt.insertRow(wtp);
- var nCell=nRow.insertCell(0);
- nCell.className="window1";
- nCell.innerHTML = message + "<br />" + form;
- }
- function login(){
- get('username','name')[0].value = get('un','id').value;
- get('password','name')[0].value = get('pw','id').value;
- get('loginForm','name')[0].submit();
- }
- if(location.href.match(/.co.uk/) && vf_username == 'guest'){
- build();
- }
- </script>