Advertise activity in a private category (discourse-category-lockdown)

What are the entry restrictions for the current_member group?

I have a forum running both plugins, it worked fine with a private group last time I checked

2 Likes

Gah! :man_facepalming: I was missing the obvious and didn’t have this checked at the bottom of the category settings:

All is well!

2 Likes

The subscriptions plugin should already be doing that. Its tightly integrated with discourse groups which is tightly integrated with category security settings. :wink:

2 Likes

I’ve been looking for a plugin that does almost exactly this (and didn’t realize it existed!). Can you clarify what this statement means though? Just that the thread will be indexed in Google?

If a user not in the group or a user who isn’t logged in navigates to the thread, they will always go to the payment gateway (or whatever link), right?

1 Like

Yes, but the topic entry and some bits and pieces of the content appear in the search results. If that’s ok for you, then that’s it.

Recently, I added a feature to allow category specific redirects.

If you want something more comprehensive, you can look at Discourse Subscriptions

2 Likes

This seems more ideal for my use than Discourse subscriptions because I’m using WordPress and SSO for the membership. I will give it a try.

1 Like

Very easy to configure and I think I have it working properly.

Random question, is it possible to inject a custom icon? i.e. a site logo to use as the icon instead of the font awesome icons? I currently only have it as a png

1 Like

It’s something you can do with some css, I made something similar, but I didn’t keep the code.

If I remember correctly, you need two steps: hiding the custom icon, I used the star icon in my custom theme, then add the custom image before the title

.topic-list .category-idofyourcategory {
    .topic-status .d-icon-star {
        display: none;
    }
    .title::before {
        content: url("/your_image.png");
    }
}

I didn’t reproduce it, so you might need to adjust a few things, but it should give you some direction

3 Likes

I’m re-directing to a WordPress page (my OAuth provider) which allows the user to sign up for a subscription to view the content, or just login.

The issue is that if they login and go back to the forum, they are not automatically logged into the forum (and have to click the Login button again on the forum). What do I need to change to try to make sure they are automatically logged in? Is there something I can add to my link?

If it allows you to redirect to a url you will want to add this to the end of your discourse url /session/sso?return_path=/top, you can change the path it redirects to, but this should log them in for you.

2 Likes

Outstanding! I used to be able to do this on Xenforo, so I was hoping there would be something similar on Discourse. It’s ideal for paid communities to pull folks into premium portions of the forum.

Many thanks,
Ray

P.S. @davidkingham David, took a gander at your community. It’s one of the best I have seen. Props and thanks for sharing.

Ray

2 Likes

This plugin appears to break in 2.6 beta 2. @fzngagan Discourse doesn’t allow me to load any topics when it is activated, see errors below.

Message (204 copies reported)

ArgumentError (wrong number of arguments (given 1, expected 0))
lib/topic_view.rb:59:in `initialize'
app/controllers/topics_controller.rb:81:in `new'
app/controllers/topics_controller.rb:81:in `show'
app/controllers/application_controller.rb:340:in `block in with_resolved_locale'
app/controllers/application_controller.rb:340:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:68:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:334:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:22:in `call'
lib/middleware/request_tracker.rb:176:in `call'

Backtrace

plugins/discourse-category-lockdown/plugin.rb:41:in `check_and_raise_exceptions'
lib/topic_view.rb:59:in `initialize'
app/controllers/topics_controller.rb:81:in `new'
app/controllers/topics_controller.rb:81:in `show'
actionpack (6.0.3.2) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (6.0.3.2) lib/abstract_controller/base.rb:195:in `process_action'
actionpack (6.0.3.2) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (6.0.3.2) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (6.0.3.2) lib/active_support/callbacks.rb:112:in `block in run_callbacks'
app/controllers/application_controller.rb:340:in `block in with_resolved_locale'

Env
1 Like

This was also on my list of things to figure out. It seems it was broken by this change (4 days ago)

4 Likes

Thanks @RGJ for pointing out the cause.
I’ll make it a priority and look at this one in my morning time.

3 Likes

@davidkingham @RGJ, @dylanb
Just pushed a fix. Please update and confirm.

4 Likes

@fzngagan Looks like it is working properly. Thanks for the quick fix.

3 Likes

Although the plugin does not crash now, it does not function on tests-passed anymore.

The icon shows but you can access topics within a category as normal.

Just tested this by having a working plugin on 2.5, then moving to tests passed broke it.

Edit this seems like a multisite issue. The check_and_raise_exceptions function is only prepended when the plugin is enabled on multisite master. Also, Discourse needs to be restarted after enabling the plugin.

3 Likes

I’ve got a question and a request.

Question: how hard would it be to allow crawlers to see the content? I can’t seem to find a way of accessing whether the request is made by a crawler (or the user agent string) from within the guardian for anonymous users. Does anyone have any pointers? I would be happy to create a PR for it if only I knew how to get to this information.

Request: @fzngagan could you please take a look at the multisite issue that was recently introduced? I could make a PR although it would be a trivial change.

2 Likes

If you disable javascript in your browser, you can see the crawler layout (hence your users can too :wink: ).
I’ve made a POC branch named crawl which you can test and enchance. If it works, we’ll put it behind a site setting that will be off by default.

Note: I’ve not tested the branch but happy to help :slight_smile:

I would be happy to accept a PR here. Not familiar with multisite stuff yet :slight_smile:

2 Likes

I’ve made the pull request.

1 Like