Accessing Custom Plugin Settings


(Anthony) #1

Hello.

I’ve read some of the guides on creating your own plugins along with accessing custom plugin settings, but so far I haven’t been able to get anything to work.

So, I have the following in my settings.yml:

plugins:
  twilio_sms_enabled:
    default: false
  twilio_account_sid:
  twilio_auth_token:
  twilio_from_number:

The fields do show up in the Admin Settings, etc.

How would I go about accesing these settings in the .hbs templates? This has been driving me crazy the past few days :confused:

I’ve tried {{{SiteSetting.twilio_account_sid}}} and {{{Discourse.SiteSettings.twilio_account_sid}}} but it doesn’t display anything?

The overall purpose of the plugin I’m creating is to implement an SMS Verification system using Twilio on top of the email address verification system.


(Vinoth Kannan) #2

To access site settings anywhere in client side (either in JavaScript code or .hbs templates) you have to mention it in settings.yml file itself like below