"Message" button on user's admin page please?

Could the Message button also be placed on the user admin page please?

In moderation workflow, checking someone’s profile > sending them a PM occur often for a variety of reasons, and having to hop back out to the public profile is a minor bit of an ongoing annoyance.

Current:

Hoped for:

2 Likes

I will probably clean this up and make it into a theme component, but if you want to use it right away, add the following code to the </head> tab of the Desktop section of your main theme.

<script type="text/discourse-plugin" version="0.8">
  const h = require("virtual-dom").h;

  api.createWidget("user-admin-message-button", {
    tagName: "div.user-admin-message-button",

    html(attrs) {
      return h('a.btn.btn-primary.compose-pm', [ h('i.fa.fa-envelope.d-icon.d-icon-envelope'), 'Message' ]);
    },
    
    click() {
      const container = Discourse.__container__;
      const Composer = require("discourse/models/composer").default;
      const composerController = container.lookup("controller:composer");
      composerController.open({
        action: Composer.PRIVATE_MESSAGE,
        usernames: this.attrs.model.username,
        archetypeId: "private_message",
        draftKey: "new_private_message"
      });
    }
  });
</script>

<script type="text/x-handlebars" data-template-name="/connectors/admin-user-controls-after/user-admin-message-button">
    {{mount-widget widget="user-admin-message-button" args=(hash model=model)}}
</script>

Then add this to the CSS tab of the Desktop section of your main theme:

.user-controls div {
    display: inline-block;
}
10 Likes

Thanks! :+1:

I am a forum moderator, not admin, trying to give useful feedback from the amateur-yet-knowledgeable end of things.

I bet having to check IP/etc, then send PM, are very common mod tasks.