I have this code in my header.php :
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("a")
.filter(function() {
var href = jQuery(this).attr('href');
// return true if href exists and matches the regular expression
return href && href.match(/mywebsite\.com\/(page)\//);
})
.click(function(){
jQuery("a").attr("target","_blank");
url = jQuery(this).attr('href');
jQuery(this).attr('href','/te3/out.php?l=click&u=' + escape(url));
});
});
</script>
How can I make this code only work for users that are not logged in? (I'm using wordpress self-hosted)
Right now the code opens every '/page/*' in a new tab and makes it go through /te3/out.php but I would like that not to happen to logged in users.
I'm pretty new to this so please make it easy to understand.
Thanks a lot!