Badge SQL can no longer be edited by default

badge

(Joshua Rosenfeld) #21

Yes, send an email to team@discourse.org with the request, they’ll take care of you.


(Dylan Hunt) #22

is this an old guide?


(Rafael dos Santos Silva) #23

It’s SiteSetting and not SiteSettings.


#24

I executed ./launcher enter app and then rails c, but it doesn’t seem to start right.

After starting, it doesn’t print out anything and it doesn’t react either. Any idea?

root@scw-1a7c81-app:/var/www/discourse# rails c
^Cbundler: failed to load command: pry (/var/www/discourse/vendor/bundle/ruby/2.4.0/bin/pry)
Interrupt: 
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/core_ext/class/subclasses.rb:8:in `<class:Class>'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/core_ext/class/subclasses.rb:4:in `<top (required)>'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/core_ext/class.rb:3:in `require'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/core_ext/class.rb:3:in `<top (required)>'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionmailer-4.2.8/lib/action_mailer.rb:29:in `require'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionmailer-4.2.8/lib/action_mailer.rb:29:in `<top (required)>'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionmailer-4.2.8/lib/action_mailer/railtie.rb:2:in `require'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/actionmailer-4.2.8/lib/action_mailer/railtie.rb:2:in `<top (required)>'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/all.rb:13:in `require'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/all.rb:13:in `block in <top (required)>'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/all.rb:11:in `each'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/railties-4.2.8/lib/rails/all.rb:11:in `<top (required)>'
  /var/www/discourse/config/application.rb:2:in `require'
  /var/www/discourse/config/application.rb:2:in `<top (required)>'
  /var/www/discourse/config/environment.rb:2:in `require'
  /var/www/discourse/config/environment.rb:2:in `<top (required)>'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pry-0.10.4/lib/pry/pry_class.rb:91:in `require'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pry-0.10.4/lib/pry/pry_class.rb:91:in `block in load_requires'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pry-0.10.4/lib/pry/pry_class.rb:90:in `each'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pry-0.10.4/lib/pry/pry_class.rb:90:in `load_requires'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pry-0.10.4/lib/pry/pry_class.rb:128:in `initial_session_setup'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pry-0.10.4/lib/pry/cli.rb:206:in `block in <top (required)>'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pry-0.10.4/lib/pry/cli.rb:83:in `block in parse_options'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pry-0.10.4/lib/pry/cli.rb:83:in `each'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pry-0.10.4/lib/pry/cli.rb:83:in `parse_options'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/pry-0.10.4/bin/pry:16:in `<top (required)>'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/bin/pry:22:in `load'
  /var/www/discourse/vendor/bundle/ruby/2.4.0/bin/pry:22:in `<top (required)>'

(Jay Pfaffman) #25

That seems strange. Is your site up?


#26

Yes it is, installed discourse today on a fresh vps after not having used it for quite some time :slight_smile:


(Jay Pfaffman) #27

Perhaps try rebuilding? I thought it might be something with Ruby 2.4, but I just did a clean install and rails c comes up just fine.

You followed the INSTALL-cloud instructions and Docker, right?


#28

ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

Rails 4.2.8

Discourse v1.9.0.beta1 +79 installed yesterday using the guide and Docker.


(cosmo) #29

Guys, can anyone shed light on coding a simple badge auto award so we can get it to site owner to upload since admins can’t.

We want it that when a user is added to a specific group, it awards a custom badge.

That’s all.

If user1 is added to groupX, award badgeX


(Daniela) #30
SELECT gu.user_id, gu.created_at AS granted_at, null AS post_id
FROM group_users AS gu
WHERE gu.group_id = ( SELECT id FROM groups WHERE name ilike 'InsertTheTeamNameHere' )

Trigger daily

For reference:


Automatically Apply Badges to Group Members (in Hosted Version)
(cosmo) #31

@Trash, I had posted in another thread, and someone responded almost at the same time. The code is slightly different. Do you know what the difference would be?

main difference is: gu. vs g.

Other poster’s code:

select user_id, created_at granted_at, NULL post_id
from group_users
where group_id = (
  select g.id from groups g where g.name = 'your_group_name'
)

is there any practical difference?
I’m a complete novice at this, and I just want to give the site owner the code to copy/paste so he doesn’t have to modify it at all.

btw, the group name we are using is: Confirmed_ST_User


(Jay Pfaffman) #32

If you mean here:

select g.id from groups g where g.name = 'your_group_name'

that “groups g” means "from now on, when I say “g” I mean “groups”, so if the other one is “groups gu” and then it has gu instead of g, then it’s the same. I prefer the SQL syntax .... from groups as g, which I think is much clearer, but I don’t see it used in Discourse code much. (Probably just code I’ve submitted. :slight_smile:)


(Mathias King) #33

@team who do we email to get SQL badge triggering turned on for our site. I was unable to send @team a private message.


(Joshua Rosenfeld) #34

You need to email team@discourse.org. (I’ll PM you directly).