/discourse-paid-pinning

Allows forum members to pay for pinned topics

Primary LanguageRubyApache License 2.0Apache-2.0

Discourse Paid Pinning Plugin

Build Status

  • "Advertise" page (accessible via top menu and hamburger menu) allows users to make payment using Stripe Checkout
  • After making a payment, users are able to create a pinned topic

Advertise Page

Admin Features

  • Admins can view transactions by clicking the "Transactions" button on user admin pages

Admin Transactions

Admin Transaction Modal

  • Users with transactions are displayed with a credit card icon:

User Icon

Installation

  1. Install plugin. Instructions here. Clone URL: https://github.com/chrisbeach/discourse-paid-pinning.git
  2. Create an account at Stripe.com. On the dashboard page you'll find the necessary API keys in the "API" section
  3. On your Discourse instance: Admin > Plugins > discourse-paid-pinning Settings
    1. Enter your Stripe key (public and secret)
    2. Tweak other settings as necessary
    3. Click to "Enable paid pinning plugin"

Using the Rails Console to Manually Add or Remove Transactions

It may be necessary to perform one-off admin operations on user transactions.

Use the rails console.

To start the console, open a terminal and cd to your discourse directory (usually /var/discourse):

./launcher enter app
rails c

Remove all transactions for a user:

Example:

Txns.remove_all_txns([user_id])

(substitute the relevant user id)

Add a transaction to user:

add_txn(user, amount, created_by, type, topic_id = nil, note = "")

Example:

Txns.add_txn(User.where(id: 2).first, 10000, 1, 3, nil, "a free gift")

Reference

Author

Chris Beach <chris @ chrisbeach . co . uk>

License (Apache 2.0)

NOTE: This plugin is not supported or officially endorsed by Stripe (https://stripe.com)