by Ange Tuteur November 11th 2014, 5:13 am
Okay, try this :
Administration Panel > Modules > JavaScript codes management > Create a new script
Title : your choice
Placement : In the topics
Paste the code below :
- Code:
$(function() {
var guestText = '<span style="color:#F00">Please <a href="/login">login</a> or <a href="/register">register</a> to see this content.</span>',
topics = [1, 2, 3, 4, 5, 6],
a = document.getElementsByTagName('DIV'),i,j;
if (_userdata.user_id === -1) for (j=0; j<topics.length; j++) if (topics[j] === Number(window.location.pathname.replace(/\/t(\d+).*/,'$1'))) for (i=0; i<a.length; i++) if (/postbody/.test(a[i].parentNode.parentNode.className)) a[i].innerHTML = guestText;
});
I added an array for topic ids :
- Code:
topics = [1, 2, 3, 4, 5, 6]
Where the numbers are, is where you'll write the IDs of the topics you want the script to run in. You can add as many as you want, so long as the IDs are separated by commas.