Use data explorer to get a list of users who signed up via invitations

Hi all!

Is there a way to check the list of users who signed up to our forum via invitations?

Thanks!

2 Likes

Do you have access to data explorer? If so, you could try this:

4 Likes

I used this script in the data explorer, but it seems like an older script and did not give me any results after 2020.

SELECT user_id,
       invited_by_id as invited_by_user_id,
       redeemed_at
FROM invites
WHERE redeemed_at IS NOT NULL
ORDER BY redeemed_at DESC
1 Like

I think the invite table was split at some point. Try this one and see if it works for the newer info:

SELECT iu.user_id, 
       i.invited_by_id AS invited_by_user_id, 
       iu.redeemed_at AS reltime$time 
FROM invited_users iu
JOIN invites i ON iu.invite_id = i.id
WHERE iu.redeemed_at IS NOT NULL
ORDER BY iu.redeemed_at DESC
4 Likes

This totally worked! I just wish the CSV file that I exported would show names/usernames instead of user IDs. Any way to do that? And thanks so much! :wink:

1 Like

My SQL skills are still a little fledgling, but try this one and see if I’ve got the look-ups working properly: :slight_smile:

SELECT u1.username AS invitee, 
       u2.username AS inviter,
       iu.redeemed_at
FROM invited_users iu
JOIN invites i ON iu.invite_id = i.id
JOIN users u1 ON iu.user_id = u1.id
JOIN users u2 ON i.invited_by_id = u2.id
WHERE iu.redeemed_at IS NOT NULL
ORDER BY iu.redeemed_at DESC
5 Likes

I tested this and it works! Nice one. :sunflower:

Another query that might be useful is the pending invites. Admins might like to know what their users are up to with the invitation system.

This query however provides potentially valuable information for community building. I wonder if it could be implemented as a plugin so it’s more readily available. One idea would be to add it as an item on the groups activity menu, so you can see who in your group is doing the most inviting. Permissions could be set to allow only staff or only group members to see it.

2 Likes

I was able to update this data explorer query to include the invite_key used by the user to join the site.

SELECT u1.username AS invitee, 
       u2.username AS inviter,
       i.invite_key,
       iu.redeemed_at
FROM invited_users iu
JOIN invites i ON iu.invite_id = i.id
JOIN users u1 ON iu.user_id = u1.id
JOIN users u2 ON i.invited_by_id = u2.id
WHERE iu.redeemed_at IS NOT NULL
ORDER BY iu.redeemed_at DESC
2 Likes