Help me tweak my switch-user script
4 posters
Page 1 of 1
Help me tweak my switch-user script
So I'm using this script for a switch-user widget I have in my header, always displayed right below my forum's logo.
Something in that function is making it so that the login only works on my forum's home page. When I click the "switch user" button on any other page, nothing happens.
Can someone who knows this code please tell me how to tweak it so the login works on every page?
Here's my forum:
illustrare.forumotion.com
- Code:
<script type="text/javascript">
function switch_accounts() {
jQuery.get(document.getElementById('logout').href, function() {
jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&password='+document.getElementById('switch_pass').value, function () {
window.location.reload();
});
});
}
</script>
Something in that function is making it so that the login only works on my forum's home page. When I click the "switch user" button on any other page, nothing happens.
Can someone who knows this code please tell me how to tweak it so the login works on every page?
Here's my forum:
illustrare.forumotion.com
Sarah.givemestories- Forumember
- Posts : 38
Reputation : 2
Language : English
Location : USA
Re: Help me tweak my switch-user script
Where did you add this code?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Help me tweak my switch-user script
overall_header template.
Sarah.givemestories- Forumember
- Posts : 38
Reputation : 2
Language : English
Location : USA
Re: Help me tweak my switch-user script
Please post your forum's link.
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Sarah.givemestories- Forumember
- Posts : 38
Reputation : 2
Language : English
Location : USA
Re: Help me tweak my switch-user script
Could you send me in a PM 2 test accounts to test your code?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Help me tweak my switch-user script
So Gray wasn't able to help. Can someone who really knows coding step in?
Sarah.givemestories- Forumember
- Posts : 38
Reputation : 2
Language : English
Location : USA
Re: Help me tweak my switch-user script
i have this code as a widget
- Code:
<script type="text/javascript">
function switch_accounts() {
jQuery.get(document.getElementById('logout').href, function() {
jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&password='+document.getElementById('switch_pass').value, function () {
window.location.reload();
});
});
}
</script>
Switch user:<hr />
<input id="switch_uname" type="text" /><br />
<input id="switch_pass" type="password" /><br />
<input type="button" value="Switch user" onclick="switch_accounts();" />
Re: Help me tweak my switch-user script
Does it switch accounts on every page besides the index?
Sarah.givemestories- Forumember
- Posts : 38
Reputation : 2
Language : English
Location : USA
Re: Help me tweak my switch-user script
Could you please test it and get back to me?
Sarah.givemestories- Forumember
- Posts : 38
Reputation : 2
Language : English
Location : USA
Re: Help me tweak my switch-user script
at the moment iam not in a laptop and iam not using it to test it, so better wait for someone else to help you or you could try to test it yourself as a widget (the easiest way)
Re: Help me tweak my switch-user script
The script is the exact same as mine. It doesn't work. I guess I have to wait until someone can give me another script or help fix mine.
Sarah.givemestories- Forumember
- Posts : 38
Reputation : 2
Language : English
Location : USA
Re: Help me tweak my switch-user script
Hello,
As it seems your javascript tries to retrieve a null or missing element:
Please check if you have all the necessary elements in HTML. Otherwise you have to modify your javascript to work with your HTML elements.
As it seems your javascript tries to retrieve a null or missing element:
Please check if you have all the necessary elements in HTML. Otherwise you have to modify your javascript to work with your HTML elements.
Re: Help me tweak my switch-user script
Van-Helsing wrote:Hello,
As it seems your javascript tries to retrieve a null or missing element:
Please check if you have all the necessary elements in HTML. Otherwise you have to modify your javascript to work with your HTML elements.
What do you mean by having all the necessary elements in HTML? How do I do that, exactly?
Sarah.givemestories- Forumember
- Posts : 38
Reputation : 2
Language : English
Location : USA
Re: Help me tweak my switch-user script
Hello,
One of your templates using the below code:
This code contains some errors because the element'switch_uname' and / or 'switch_pass' elements are missing in your HTML code of template. Probably is the index_body template. For this reason the get.ElementById function returns error.
One of your templates using the below code:
- Code:
<div class="switchuser"><script type="text/javascript">function switch_accounts() {jQuery.get(document.getElementById('logout').href, function() {jQuery.post('/login', 'login=1&username='+document.getElementById('switch_uname').value+'&password='+document.getElementById('switch_pass').value, function () {window.location.reload();});});}</script><input id="switch_uname" size="6" type="text"> <input id="switch_pass" size="9" type="password"> <input value="Switch Character" onclick="switch_accounts();" type="button"></div>
This code contains some errors because the element'switch_uname' and / or 'switch_pass' elements are missing in your HTML code of template. Probably is the index_body template. For this reason the get.ElementById function returns error.
Similar topics
» A script when i ban an user.
» Script to force user to present before posting.
» Switch user page out with a html page
» Tweak these please...
» Suggested Script (Need Someone that can read script)
» Script to force user to present before posting.
» Switch user page out with a html page
» Tweak these please...
» Suggested Script (Need Someone that can read script)
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum