Add a button at the bottom of a topic, visible to a specific group: discourse-topic-group-button

official

(Arpit Jalan) #1

discourse-topic-group-button

This plugin adds a custom button at the bottom of a topic, visible only to staff or members of a specific group.

Configuration

From Admin > Site Settings > Plugin, modify

  • topic_group_button_url
  • topic_group_button_title
  • topic_group_button_label
  • topic_group_button_allowed_group

Installation

  • Add the plugin’s repo url to your container’s app.yml file
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/techapj/discourse-topic-group-button.git
  • Rebuild the container
cd /var/discourse
git pull
./launcher rebuild app

Note: For button to be visible to everyone, see:


Option to insert frequently used text in the post editor
Hidden category not hidden in top menu
Hook for extra buttons at the bottom of a post
I want to customize UI based on the users group membership
(Ivan Rapekas) #6

Is there any way to link this button to some dynamic URL with a variable in the address? The variable is assigned internally, I suppose the same way as for email subject: [%{site_name}] %{optional_pm}%{optional_cat}%{topic_title} maybe…

For example, https://new.example.com/discuss/t/{topic_slug}, where {topic_slug} is a slug of current topic. This is useful in case of old forum A migration to forum B (Discourse instance). It would be nice to have a button for staff, which quickly routes from the new forum B to the same topic on the old forum A (both forums have equal slugs):

`https://new.example.com/discuss/t/{topic_slug} --> https://old.example.com/support/topic/{topic_slug}`

(Arpit Jalan) #11

Actually this plugin was extracted out of the plugin I wrote for Twitter.

The Twitter plugin does support variables as per: twitter-topic-group-button/twitter-topic-group-button.js.es6 at a5a9e47c44ec3e5745f73df2c3cb59005a57f8f5 · techAPJ/twitter-topic-group-button · GitHub

I will gladly accept a PR to add the same functionality to plugin linked in first post.


(Arpit Jalan) #13

As I just mentioned in above post, happy to accept a PR. :slight_smile:


(Ivan Rapekas) #14

Hi, @schungx, @techAPJ
Thank you for your support, and sorry for my poor English. Yes, I need a button, described at the first post. It links to external URL which depends on part of URL of current topic (topic slug, for example).
As mentioned, in this case I need to expand some forum variables. But as a newbie to developers, I am not sure about my next steps. PR is a push request, right?)


(Carlo Kok) #17

This seems to have broken in a recent commit on this:

TypeError: e.lookupFactory is not a function[Meer info] [_plugin-third-party-d7db1d14cddf8f40d5f2dd6378f24e27600d0b58b2492076344a05a2b8846c90.js:26:40](https://talk.remobjects.com/assets/_plugin-third-party-d7db1d14cddf8f40d5f2dd6378f24e27600d0b58b2492076344a05a2b8846c90.js)

XML-parsefout: syntaxisfout Locatie: https://talk.remobjects.com/logs/report_js_error Regelnummer 1, kolom 1:

(Jeff Atwood) #18

@techapj is this Ember 3 related?


(Arpit Jalan) #19

No, this was older Ember deprecation for lookupFactory. Fixed via: