# Plugin Login to view content (Working)

**URL:** https://meta.discourse.org/t/plugin-login-to-view-content-working/126196
**Category:** Development
**Created:** [August 19, 2019, 4:58pm UTC](https://meta.discourse.org/t/plugin-login-to-view-content-working/126196 "2019-08-19T16:58:24Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![tohaitrieu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tohaitrieu/32/151338_2.png) [@tohaitrieu](https://meta.discourse.org/u/tohaitrieu)
#### Post date: [August 19, 2019, 4:58pm UTC](https://meta.discourse.org/t/plugin-login-to-view-content-working/126196/1 "2019-08-19T16:58:25Z")

</div>

Hi Everybody.

Hi everybody

I created a Plugin based on the idea of BBCode Color Plugin and BBCode Lock.

Currently I have made it work, but I have not been able to change the css class when the visitor is not logged in and logged in.

How do I know if a member has logged in and changed the css class value?

I use BBCode:

```
[hideto=guest]Content Hide.[/hideto]

```

Example:

 ![28%20PM](https://global.discourse-cdn.com/meta/original/3X/3/0/309e57cb1fbb47d548e6f66d54588d5a58b2618d.png)

Plugin: [GitHub - tohaitrieu/discourse-bbcode-hide: Hide content from guest for Discourse · GitHub](https://github.com/tohaitrieu/discourse-bbcode-hide)

BBCode Color Plugin: [GitHub - discourse/discourse-bbcode-color: A Discourse Plugin to support BBCode color tags. · GitHub](https://github.com/discourse/discourse-bbcode-color)

BBCode Lock (Broken Plugin): [GitHub - vinkashq/discourse-bbcode-lock: A Discourse plugin to lock post contents to guest (anonymous) users · GitHub](https://github.com/vinkashq/discourse-bbcode-lock/)

Please help me to complete this plugin

Thank you.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [August 19, 2019, 5:22pm UTC](https://meta.discourse.org/t/plugin-login-to-view-content-working/126196/2 "2019-08-19T17:22:37Z")

</div>

When no user is logged in, the `html` element has a class called `anon`.  
So prefixing any CSS selector with `html.anon` will do the trick.

---

<div class="post-metadata">

### Author: ![tohaitrieu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tohaitrieu/32/151338_2.png) [@tohaitrieu](https://meta.discourse.org/u/tohaitrieu)
#### Post date: [August 19, 2019, 6:12pm UTC](https://meta.discourse.org/t/plugin-login-to-view-content-working/126196/3 "2019-08-19T18:12:33Z")

</div>

Wow. BBCode is working right now. Thank you!

---

<div class="post-metadata">

### Author: ![PaigeLynn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paigelynn/32/151098_2.png) [@PaigeLynn](https://meta.discourse.org/u/PaigeLynn)
#### Post date: [August 19, 2019, 6:24pm UTC](https://meta.discourse.org/t/plugin-login-to-view-content-working/126196/4 "2019-08-19T18:24:24Z")

</div>

Installing now I’ll Let you know how it goes 🙂

---

<div class="post-metadata">

### Author: ![tohaitrieu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tohaitrieu/32/151338_2.png) [@tohaitrieu](https://meta.discourse.org/u/tohaitrieu)
#### Post date: [August 19, 2019, 6:29pm UTC](https://meta.discourse.org/t/plugin-login-to-view-content-working/126196/5 "2019-08-19T18:29:36Z")

</div>

I’m working to add Signup and Login button to BBCode.

---

<div class="post-metadata">

### Author: ![PaigeLynn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paigelynn/32/151098_2.png) [@PaigeLynn](https://meta.discourse.org/u/PaigeLynn)
#### Post date: [August 19, 2019, 6:31pm UTC](https://meta.discourse.org/t/plugin-login-to-view-content-working/126196/6 "2019-08-19T18:31:48Z")

</div>

> [@tohaitrieu](#):
>
> [hideto=guest]Content Hide.[/hideto]

So I see this

![58%20PM](https://global.discourse-cdn.com/meta/original/3X/5/c/5cfbd844dfc3ac6a79668fb8ace1ce3959ce6518.png)  
How can I change the language to english

---

<div class="post-metadata">

### Author: ![tohaitrieu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tohaitrieu/32/151338_2.png) [@tohaitrieu](https://meta.discourse.org/u/tohaitrieu)
#### Post date: [August 19, 2019, 6:40pm UTC](https://meta.discourse.org/t/plugin-login-to-view-content-working/126196/7 "2019-08-19T18:40:02Z")

</div>

I use css to hide content. I’m a newbie, now I have no option to change the text in admin. You can **Fork my repo to your account** and edit file:

```
discourse-bbcode-hide/assets/stylesheets/bbcode_hide.scss

```

Line 19th:

```
content: "Bạn phải đăng nhập để xem nội dung (Miễn Phí).";

```

---

<div class="post-metadata">

### Author: ![PaigeLynn](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paigelynn/32/151098_2.png) [@PaigeLynn](https://meta.discourse.org/u/PaigeLynn)
#### Post date: [August 19, 2019, 6:40pm UTC](https://meta.discourse.org/t/plugin-login-to-view-content-working/126196/8 "2019-08-19T18:40:41Z")

</div>

OK thanks Ill Take a look 🙂

---

<div class="post-metadata">

### Author: ![tohaitrieu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tohaitrieu/32/151338_2.png) [@tohaitrieu](https://meta.discourse.org/u/tohaitrieu)
#### Post date: [August 19, 2019, 7:31pm UTC](https://meta.discourse.org/t/plugin-login-to-view-content-working/126196/9 "2019-08-19T19:31:23Z")

</div>

I’m trying change from inline to Block to wrap and hide a block content.

---

<div class="post-metadata">

### Author: ![Bcat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcat/32/163148_2.png) [@Bcat](https://meta.discourse.org/u/Bcat)
#### Post date: [December 23, 2019, 7:33am UTC](https://meta.discourse.org/t/plugin-login-to-view-content-working/126196/10 "2019-12-23T07:33:41Z")

</div>

[quote=“tohaitrieu, post:1, topic:126196”]  
[hideto=guest]Content Hide.[/hideto]

It does not run  
`[hideto=guest]Content Hide.[/hideto]`  
[/quote]

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/0/a091315e838dabfedff54c8c979f36a0917e4332.png)
