1 catar4 Aug 17, 2005 22:30
3 edb Aug 17, 2005 23:46
It's a function all right, and it lives in b2evocore/_functions_users.php. Hope it helps.
4 catar4 Aug 18, 2005 19:24
It really does help. Thanks EdB.
All I had to do was to go and add an ID for the link created in the user_login_link function ... called it V1
Then in the _main.php file of my blogall's skin I simply added
<script type="text/javascript">
<!--
javascript:window.V1.click();
//-->
</script>
After this bit of code
<div class="bSideItem">
<h3><?php echo T_('Misc') ?></h3>
<ul>
<?php
user_login_link( '<li>', '</li>' );
user_register_link( '<li>', '</li>' );
user_admin_link( '<li>', '</li>' );
user_profile_link( '<li>', '</li>' );
user_logout_link( '<li>', '</li>' );
?>
</ul>
</div>
This works very well with Internet Explorer but it does not work with Firefox and Mozilla (those two dont like my little javascript). Here's the error log in Firefox's JAvascript Console:
Error: window.V1 has no properties
Am putting it here in case someone would be a javascript expert that knows what this problem is and also because I didnt find a solution yet :-/
5 kweb Aug 18, 2005 21:45
Try this:
<script type="text/javascript">
<!--
document.getElementById("V1").click();
//-->
</script>
6 catar4 Aug 19, 2005 17:06
Thanks Kweb for the quick reply.
I already had tried to use this line:
javascript:document.getElementById("V1").click();
I tried to your suggestion, here's the error it gives me now:
Error: document.getElementById("V1").click is not a function
What's weird is that it works perfectly when I access the page with Internet Explorer but it gives me the error above with Firefox (and thats what the majority of people here use).
I keep on searching for a solution, if I come up with one I'll put it here. Feel free to continue suggesting me possible solutions, they are very welcome ;)
7 kweb Aug 19, 2005 18:23
Ok. That was a guess - I didn't test it.
Instead of trying to click the link, why don't you write your JavaScript to just redirect the user to the login URL. Or even better - you could do it in PHP, and redirect the user before displaying the page at all.
8 catar4 Aug 19, 2005 21:31
I suceeded in implementing it using this line of code:
javascript:document.location=document.getElementById("V1").href;
Now it works with Firefox/Mozilla and IE
As to why I didnt write a Javascript to just redirect to the login URL or use PHP to redirect before displaying the page is because I hadnt thought about those options before I started coding the solution I'm using. Plus I'm far from a web guru, PHP and JS are pretty new to me ... I "tried" making it simple :roll:
The fact is Im spending about 30 minutes a day on this project since it's a secondary project, am working on another more important project. The quality of my work on the weblogs suffered due to that.
I know my solution is far from ideal but it's good for what we need here since the blogs are hosted on intranet. If anyone is interested in implementing my solution, request it here (I would put it here now IF I had the time to do so but instead I'll wait to see if it interests anyone)
9 kweb Aug 19, 2005 22:24
Glad you got it working. I understand the need to get it done in a short amount of time.
If you get a chance, you should post your solution, and someone who has more time might take a crack at making it more efficient or creating version that is all server-side (no javascript). Then you could benefit from their work later if you want to upgrade your setup a little. Just a thought.
10 catar4 Aug 23, 2005 19:39
Aye I will post it here in the forums, Im still tweaking in when I have some free time to spare, its not yet working exactly as we want it (but it's up and running) so I will post this in the right forum in another thread, later.
Stay tuned :)
I'd like to know where this function, found in the _main.php file of every skin, can be found and altered.
The function is: user_login_link( '<li>', '</li>' );
How does it work ? (Im completely lost on this one!! It must be simple but Im too dumb to see what it does !)
Help a fellow in distress ;)