Content Lock BBCode

(Vinoth Kannan) #1

#Lock BBCode by Vinkas

Lock post contents to guest (anonymous) users



How to install a plugin : a guide by @techAPJ

The [lock=guest][/lock] bbcode has been created but I didn’t add a button, It’s on the roadmap.

Currently lock message can be customized via CSS only. like blow example:

.anon .lock.guest::before {
 content: 'This content is locked. Please login to view.';


In your posts, surround text with [lock=guest] ... [/lock]. For example:

   I watched the murder mystery on TV last night. [lock=guest]The butler did it[/lock].


Locked contents are not removed entirely for anonymous users. It just hidden behind the message via simple CSS. So the search engines can still read the post. Also RSS feeds and email digest will display posts publicly.

Can I let some link or words visible after login?
Help with hiding content until someone registers
Login required to see topic info
(Eli the Bearded) #2

Examining the code, it looks like the test for “logged in” is implemented in the CSS. That negates the biggest use I see for this, stopping bots from reading the locked text.

(Vinoth Kannan) #3

Yes. Content not removed entirely for anonymous users. It just hidden behind the message via simple CSS. So the search engines can read the posts normally. I did like this to keep SEO not affected.

I needed this use case for my own website. Main reason for this plugin is to force anonymous users to register on our forum. Not intended to protect the content. That’s why I didn’t used the name [protected] for bbcode.

(Eli the Bearded) #4

Thinking about it further, the RSS feed will have unblocked content, too, right? Maybe it it useful to you, but you should document these limitations before others get the wrong idea about the protections involved.

(Vinoth Kannan) #5

Yes. I will show the limitations.

(Vinoth Kannan) #6

I just added the limitations block. This is my first plugin. My very first code in both Ruby and Ember too. So I welcome reviews about my code and plugin.


Great plugin. Can you make a plugin similar to this which asks users to like the post to view the content?

So all the users need to like the post to view the content.

(Vinoth Kannan) #8

Thanks. I will do if you can make some donation.

(Marcos P) #9

Nice plugin, thanks!

(Colin Marshall) #11

I moved this to #plugin:broken-plugin category due to this:

(Sam Saffron) #12

Confirmed this needs to be ported to engine to work

(Colin Marshall) #13

I could possibly assist with this if there is a plugin I could use as a reference/guide

(Vinoth Kannan) #14

You could see discourse-bbcode-color plugin for reference. Also this commit may help you for conversion.