Revolution X

Coding Community => Coding Snippets => Topic started by: Agent Moose on March 15, 2009, 12:10:49 pm



Title: Block Post Links from Guests
Post by: Agent Moose on March 15, 2009, 12:10:49 pm
Footers:
Quote
<script>
var ShowGuest = "<font color='red'>[Only registered users can see links. Please <a href='/?action=login'>Login</a> or <a href='/?action=join'>Register</a>]</font>";

if(location.href.match(/topic,/i)){
//Created by Agent Moose (revolutionx.smfforfree3.com)
var name = document.getElementsByTagName("span");
for(v=0;v<name.length;v++){
if(name[v].innerHTML.match(/Hello <b>(.*)<\/b>/i)){
if(!RegExp.$1) $("div.post a").replaceWith(ShowGuest);
};};};
</script>
Original Request: http://revolutionx.smfforfree3.com/index.php/topic,437.0.html (http://revolutionx.smfforfree3.com/index.php/topic,437.0.html)

I have no idea why, but this code didn't want to work with me when I used all javascript.

Anyway, I got it done :)

You may edit the red text.

Enjoy :)


Title: Re: Block Post Links from Guests
Post by: Qub1 on March 15, 2009, 01:47:47 pm
Thanks for making, moose, but for some reason i can't use this one and the post blocker for certain boards, because i have guides on my forum that are members only, and links that are members only. Could you please take a look at it?


Title: Re: Block Post Links from Guests
Post by: Agent Moose on March 16, 2009, 05:56:11 pm
So, you want this code to only block link's in certain boards, right?


Title: Re: Block Post Links from Guests
Post by: Mojobojo82 on March 29, 2009, 01:50:49 am
do we even edit
Code:
<font color='red'>[
and
Code:
a>]</font>";


Title: Re: Block Post Links from Guests
Post by: Mojobojo82 on March 29, 2009, 01:51:30 am
or we just edit
Code:
Only registered users can see links. Please <a href='/?action=login'>Login</a> or <a href='/?action=join'>Register


Title: Re: Block Post Links from Guests
Post by: Danidemps on March 29, 2009, 02:09:07 am
you can edit <font color='red'>[  To any colour you want and

<a href='/?action=login'>Login</a> or <a href='/?action=join'>Register
The register part makes it so they have to register before use =)


Title: Re: Block Post Links from Guests
Post by: Mojobojo82 on March 29, 2009, 02:43:20 am
hmm for some reason its not working


Title: Re: Block Post Links from Guests
Post by: Qub1 on March 29, 2009, 02:03:06 pm
yeah, same problem here :o
Anyway, i made my own code so i don't really need it anymore  :P


Title: Re: Block Post Links from Guests
Post by: Mojobojo82 on April 03, 2009, 12:04:02 am
not working :( help plz


Title: Re: Block Post Links from Guests
Post by: Andrew on June 25, 2009, 01:07:05 pm
hmm weird...I tested it before and it worked fine, now its not working for me either.

Nothing in it was edited, I used this code:
Code:
<script>
var ShowGuest = "<font color='red'>[Only registered users can see links. Please <a href='/?action=login'>Login</a> or <a href='/?action=join'>Register</a>]</font>";

if(location.href.match(/topic,/i)){
//Created by Agent Moose (revolutionx.smfforfree3.com)
var name = document.getElementsByTagName("span");
for(v=0;v<name.length;v++){
if(name[v].innerHTML.match(/Hello <b>(.*)<\/b>/i)){
if(!RegExp.$1) $("div.post a").replaceWith(ShowGuest);
};};};
</script>


Title: Re: Block Post Links from Guests
Post by: Mojobojo82 on June 26, 2009, 01:31:03 am
Same.
I just copied the code up above.
Not doing anything  >:(