Hey guys,
I have recently used a script from the French Support Forums: http://forum.forumactif.com/t260631-astuce-utiliser-les-variables-user-et-forum-autre
Now it's working, but only for staff. If the user is not in a staff user group. The name does not show up.
Here is the code that I'm using, it's in the index_body, just under the {JAVASCRIPT} variable.
And here is the javascript:
I have recently used a script from the French Support Forums: http://forum.forumactif.com/t260631-astuce-utiliser-les-variables-user-et-forum-autre
Now it's working, but only for staff. If the user is not in a staff user group. The name does not show up.
Here is the code that I'm using, it's in the index_body, just under the {JAVASCRIPT} variable.
- Code:
<div id="user_info">
<!-- BEGIN switch_user_logged_in -->
<div id="user_avatar" class="fl"><!-- avatar here --></div>
Welcome Back, <span class="USERNAME"></span> <br /><br />
<div id="add_links">
<ul>
<li><a href="{U_SEARCH_NEW}">{L_SEARCH_NEW}</a></li>
<li><a href="{U_SEARCH_SELF}">{L_SEARCH_SELF}</a></li>
<li><a href="{U_SEARCH_UNANSWERED}">{L_SEARCH_UNANSWERED}</a></li>
<li><a href="{U_MARK_READ}">{L_MARK_FORUMS_READ}</a></li>
</ul>
</div>
<!-- END switch_user_logged_in -->
<!-- BEGIN switch_user_logged_out -->
<p>Hello Guest,<br /> It appears that you are not logged in or that you have not registerd. You can Log-in or Register bellow!</p><br />
<a href="http://code-phase.forumotion.co.uk/login"> <img src="http://i43.servimg.com/u/f43/16/93/80/74/login10.png" alt="Log-In" /></a>
<a href="http://code-phase.forumotion.co.uk/register"> <img src="http://i43.servimg.com/u/f43/16/93/80/74/regist10.png" alt="Log-In" /></a>
<!-- END switch_user_logged_out -->
</div> <!-- end user_info -->
And here is the javascript:
- Code:
function treatvar(nom) {
var trouve = xhr.responseText.replace(RegExp("^.+<li style=\"margin-bottom:5px;direction:ltr;text-align:left;\"><strong>{" + nom + "}<\/strong>Â :Â (.*?)Â <span style='direction:ltr'>\(.*?\)<\/span><br \/><\/li>.+$"), '$1');
if (xhr.responseText == trouve) return;
var children = document.getElementsByTagName('*') || document.all;
var v = new Array();
var i = -1;
while (++i < children.length) {
var child = children[i];
var classNames = child.className.split(' ');
for (var j = 0; j < classNames.length; j++) {
if (classNames[j] == nom) {
v.push(child);
break;
}
}
}
i = -1;
while (++i != v.length) if (v[i].tagName == 'INPUT' || v[i].tagName == 'TEXTAREA') v[i].value += trouve;
else v[i].innerHTML += trouve;
};
if (window.ActiveXObject) {
var xhr = new ActiveXObject("Microsoft.XMLHTTP");
} else if (window.XMLHttpRequest) {
var xhr = new XMLHttpRequest();
}
if (xhr != null) {
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
treatvar('FORUMURL');
treatvar('FORUMURLINK');
treatvar('FORUMNAME');
treatvar('FORUMNAMELINK');
treatvar('FORUMDESC');
treatvar('FORUMBIRTHDAY');
treatvar('FORUMAGE');
treatvar('FORUMCOUNTFORUM');
treatvar('FORUMCOUNTOPIC');
treatvar('FORUMCOUNTPOST');
treatvar('FORUMCOUNTUSER');
treatvar('FORUMONLINEUSER');
treatvar('FORUMONLINEDATE');
treatvar('FORUMLASTUSER');
treatvar('FORUMLASTUSERLINK');
treatvar('USERNAME');
treatvar('USERLINK');
treatvar('USERBIRTHDAY');
treatvar('USERAGE');
treatvar('USERREGDATE');
treatvar('USERLASTVISIT');
treatvar('USERCOUNTPOST');
}
};
xhr.open("GET", "/popup_help.forum?l=miscvars", true);
xhr.send(null);
}