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
Hide "NEW" for TL1 and above
(Carlo Kok) #2

Could it be this one broke with the recent HEAD (~ since about a week)?


(Carlo Kok) #3

It looks likely this change Migration topic footer buttons to components · discourse/discourse@0f1ed1e · GitHub by @eviltrout broke this.


(Jeff Atwood) #4

I am sure @techAPJ can get it fixed up when he gets a chance.


(Arpit Jalan) #5

Just pushed a commit to fix deprecations. Rebuild your instance and everything should be fine.

Thanks for bringing this issue in our notice! :thumbsup:


(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}`

(Stephen Chung) #7

Err… may I ask a silly question? What does the button… er… do?


(Arpit Jalan) #8

Links to a specific/custom link/url, set via:


(Stephen Chung) #9

Well, won’t that be of limited usefulness, unless you have a whole bunch of variables to expand for the url, as suggested by @Ivan_Rapekas?


(Arpit Jalan) #10

There are, I think I forgot to add them in first post. Let me do that now.


(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.


(Stephen Chung) #12

Are you sure?

Doesn’t look like it. And you probably want to have a setting controlling whether a new window is opened or just follow the link in the current window.


(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?)


(Richard - DiscourseHosting.com) #15

Made the PR, it now accepts the same variables as the Twitter topic plugin does: USERNAME, USER_ID and TOPIC_ID


(Anton) #16

Interested to hear about use-cases for this plugin. How do you use it?