Special usernames for Conversation::actionAdd()

digitalpoint

Well-known member
I've run into the situation a few times where we have a link for users to start a conversation with moderators or admins with the username pre-filled for them like so:

https://example.com/conversations/add?to=admin1,admin2,admin3

However, those links become stale over time as mods/admins come and go or change their usernames. It leads to people contacting someone who is no longer a mod/admin for something mod/admin-related.

It would be nice if the Conversation::actionAdd() method could take a couple special "usernames" where you may want the message to go to all mods or all admins (at the time). Something like a username of @admins and/or @moderators

So if you had a link that is intended for all admins, it could be:

https://example.com/conversations/add?to=@admins

It looks like it would be a fairly simple change to the actionAdd() method... ignore initial username validation if the username starts with @, then expand it out to the true usernames when someone submits their message.

I'm going to go ahead and extend the Conversation class to do it on my end, but seems like it may have use for others (and looks to be fairly simple changes to that one method).
 
Upvote 10
There... done. :)

PHP:
class Conversation extends XFCP_Conversation
{
    public function actionAdd()
    {
        $to = explode(',', $this->filter('to', 'str'));
        $toOutput = [];

        foreach ($to as $username)
        {
            if (strtolower($username) === '@admins')
            {
                $admins = $this->repository('XF:Admin')->findAdminsForList()->fetch();
                if ($admins)
                {
                    foreach ($admins as $admin)
                    {
                        $toOutput[$admin->username] = true;
                    }
                }
            }
            elseif (strtolower($username) === '@moderators')
            {
                $moderators = $this->repository('XF:Moderator')->findModeratorsForList()->fetch();
                if ($moderators)
                {
                    foreach ($moderators as $moderator)
                    {
                        $toOutput[$moderator->User->username] = true;
                    }
                }
            }
            else
            {
                $toOutput[$username] = true;
            }
        }

        unset($toOutput[\XF::visitor()->username]);
        $this->request->set('to', implode(',', array_keys($toOutput)));

        return parent::actionAdd();
    }
}
 
This could be very handy. One thing we try to tell members to do is never message an individual staff member, but to please report everything, so the first available staff can handle it. Giving them an option to do this (with a template edit to remind them to send a message to moderators or admins), would solve a few problems for us.

If not in core, this could be a really good add-on. As much as I dislike Reddit, this is one feature of theirs that I like.
 
Hmm, I don't think conversations are the way to go for such communication.

We usually handle such things with forums where non-staff users can only see their own threads, this way users can easily start non-public communication with staff with all functionality available for forum posts.
 
Hmm, I don't think conversations are the way to go for such communication.
It parallels what other sites use, and some members are used to that. Plus it's not either/or--it's better to have multiple ways to contact staff. None of the staff likes the separate forum idea. I already mentioned it, and it was unanimously shot down. 🤷‍♂️ Ah well, I just try to help...
 
I like this suggestion. It might be ‘reinventing the wheel’ a touch in that we already have ways to report content and create private threads etc, but more ways to contact the staff cannot be a bad thing.
 
This can also come in handy for a staff conversation--the benefit here is that staff get email when new conversations arrive, where they may or may not have staff forum post/thread notifications turned off.
 
Plus it's not either/or--it's better to have multiple ways to contact staff.
I tend to disagree here as well.

Multiple ways of contacting staff also means that (important) information might be split over a dozen places:
  • Forum posts
  • Profile posts
  • Conversations
  • Probably emails (if sent through the contact from to an email mailbox)
  • Chat / Shoutbox (if available)
  • Ticket system (if available)
If information is needed you end up searching a dozen places as well and you can't even search all them at once so finding that information becomes tedious/time consuming.

Therefore at least I prefer to have everything in one place - unified communication FTW :)

None of the staff likes the separate forum idea. I already mentioned it, and it was unanimously shot down. 🤷‍♂️
Everybody should use what works best for them.

As said, I only see disadvantages in using conversations over forum posts:
  • They can't be searched (without Add-ons)
  • They can't be organized with Tags or Prefixes (without Add-ons)
  • They can't be rearranged (splitted, merged or moved somewhere else) (without Add-ons)
  • It is not possible to revoke access if a staff member quits, they will have access to the conversations forever (if they don't leave the conversation themselves or if an Add-on is used)
  • New staff members must manually be added to existing conversations
  • Conversations might trigger E-Mail notifications for every participant which can be pretty annoying if one does want notifications for "real" private conversations, but not for every user seeking support for a simple question
  • If all staff members that were participants of a conversation with a user have left the site, no staff member would have access to to the conversation (unless the user does manually add a new one)
 
Last edited:
Multiple ways of contacting staff also means that (important) information might be split over a dozen places:
  • Forum posts
  • Profile posts
  • Conversations
  • Probably emails (if sent through the contact from to an email mailbox)
  • Chat / Shoutbox (if available)
  • Ticket system (if available)
The only way to contact staff privately, as a group, is via a report--not intuitive since some members think they're going to get in trouble (yeah, I know) if they report themselves. We have no public forum set up for member issues, profile posts are removed (thank goodness!), we don't use chat or a ticket system, and members rarely use email--only after they've been banned or have login/registration issues, typically, and email is only monitored by one volunteer staff member, checked once a day.

The main problem is someone will start a conversation with a "favorite" staff member with an issue that needs to be handled quickly, and that staff member might not be on for the day, the week, or may have been one of those who without a word, abandoned the forum completely, without the member or the rest of the staff knowing it. On all of the forums I run, the go-to for members is always a conversation, so it makes the most sense to add this where members are contacting us the most. It's also a shortcut for staff to message the entire team--with over a dozen mods and/or admins, I certainly can't remember to include them all.

Makes more sense to have this feature. Don't like it? Don't install it. 🤷‍♂️ The report system is the only way to do it now, privately and to the entire staff. Not intuitive at all.
 
The only way to contact staff privately, as a group, is via a report
[...]
The report system is the only way to do it now, privately and to the entire staff. Not intuitive at all.
It ain't if you use a forum as outlined in https://xenforo.com/community/threa...or-conversation-actionadd.199777/post-1545134

This wouldn't need any Add-ons or special usernames - users just have to open a thread and can privately communicate with the entire team, I really don't think there is anything that could be more intuitive.

But as said before, I am not against such a "group conversation" feature - I just wouldn't use it and wanted to point out a way that can easily be used right now.
 
There... done. :)
I wonder if there is an easy way to retrieve whether or not a mod and/or admin are part of the staff (who could be addressed as "@Staff"), which is set here:

1636378846508.png

I see how you are retrieving moderators and admins:

$moderators = $this->repository('XF:Moderator')->findModeratorsForList()->fetch();

But, I'm not familiar enough with the innards of XF to know if "staff" is easily retrievable.

Someone should bundle this up as an add-on... 😉
 
I wonder if there is an easy way to retrieve whether or not a mod and/or admin are part of the staff (who could be addressed as "@Staff"), which is set here:

View attachment 259910

I see how you are retrieving moderators and admins:

$moderators = $this->repository('XF:Moderator')->findModeratorsForList()->fetch();

But, I'm not familiar enough with the innards of XF to know if "staff" is easily retrievable.

Someone should bundle this up as an add-on... 😉

Working on it.
 
Why staff and not moderators & admins?
That way, in our setup, it would include all moderators and admins. Not all admins are moderators, and not all moderators are admins. I also have a couple of staff members who are neither--they assist me with a few things, but don't need that kind of access. Personally I'd find more use for @Staff than I would @moderators (or @mods, which would be a better shorthand) and @admins.

Working on it.
Why am I not surprised? 😁
 
I have it now so if you use the following:

@admins Will add all administrators to the conversation.
@moderators Will add all moderators to the conversation.
@staff Will add all administrators and moderators to the conversation.

You can use those in a link like digitalpoint mentioned, and you can also just add that to the recipient field.

Also have all three of those as options, so each site can change the keywords to what ever they want. Has usergroup permissions on who can use the keywords.
 
Top Bottom