No problem. So, if you need just the one module, this replaces the existing one and makes it so that only members can see it:
function print_module_customtext() {
var Page p = get_page();
if (viewer_is_member()) {
open_module("customtext", $*text_module_customtext, $*text_module_customtext_url);
print safe $*text_module_customtext_content;
close_module();
}
}
You would customize title and content in Customize as usual. (BTW, I don't know if you need help with layers so I haven't explained about them but I can if you need me to).
If you want to display two modules but have the second one only visible to members, you'd use this instead:
function print_module_customtext() {
var Page p = get_page();
open_module("customtext", $*text_module_customtext, $*text_module_customtext_url);
print safe $*text_module_customtext_content;
close_module();
var string title = "Members-Only";
var string title_url = "htpp://myurl.com";
var string content = """Content only visible to members""";
if (viewer_is_member()) {
open_module("customtext2", $title, $title_url);
print safe $content;
close_module();
}
}
You'd customize title and content in Customize for the first module but would need to edit title, title_url (or blank it) and content in the code above for the second, 'hidden' module.
One more thing: In the code above, the CSS class for the second module is .module-customtext2 (that's the first variable in open_module). If the custom text module has some existing styling it would be better to leave it to the usual 'customtext' so the styling applied to both modules. If you want to be able to CSS style the second module differently, you can add a second class by changing the name to 'customtext membersmodule'. However, if you used .membersmodule in your CSS customizations, keep in mind that any code savvy person would deduce this module existed if they looked at the CSS for the journal.
no subject
Date: 2012-04-09 02:11 pm (UTC)no subject
Date: 2012-04-09 07:41 pm (UTC)Replacing the existing module
Date: 2012-04-09 07:47 pm (UTC)So, if you need just the one module, this replaces the existing one and makes it so that only members can see it:
You would customize title and content in Customize as usual. (BTW, I don't know if you need help with layers so I haven't explained about them but I can if you need me to).
Adding a second module, tied to the first one
Date: 2012-04-09 07:51 pm (UTC)You'd customize title and content in Customize for the first module but would need to edit title, title_url (or blank it) and content in the code above for the second, 'hidden' module.
Re: Adding a second module, tied to the first one
Date: 2012-04-09 07:54 pm (UTC)Re: Adding a second module, tied to the first one
Date: 2012-04-09 08:00 pm (UTC)One more thing: In the code above, the CSS class for the second module is .module-customtext2 (that's the first variable in open_module). If the custom text module has some existing styling it would be better to leave it to the usual 'customtext' so the styling applied to both modules. If you want to be able to CSS style the second module differently, you can add a second class by changing the name to 'customtext membersmodule'. However, if you used .membersmodule in your CSS customizations, keep in mind that any code savvy person would deduce this module existed if they looked at the CSS for the journal.
Re: Adding a second module, tied to the first one
Date: 2012-04-09 08:07 pm (UTC)Good point. I guess I could always name it to something less suspicious like "ct2" or "potato" or something.
Re: Adding a second module, tied to the first one
Date: 2012-04-09 08:09 pm (UTC)Re: Adding a second module, tied to the first one
Date: 2012-04-09 08:10 pm (UTC)