Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
I'm interested in this too. Doing it with views would be most flexible for administrators, but hardcoding it would allow for a "View all invitations" permission (of course, now that I think about it, individual views can be restricted to certain permission levels too). It doesn't seem to me that it would be difficult to add a hardcoded page--it would just be a few DB calls, and I think the code for this is already mostly existent anyway because each user already has their "Pending" page.
Good call, ekrispin, I should have thought of that earlier. Knowing that though it seems like it wouldn't be a big deal to just use some PHP on a page to show what's in the database... can we come up with that code here for a better temporary solution?
If you just want a simple block to tell you accepted/pending/expired/total invites though, you can use this:
$sql = "SELECT * FROM {invite} WHERE received = 1";
$result = db_num_rows(db_query($sql));
$accepted = "<strong>Accepted Invitations:</strong> $result";
$xtimex = time();
$sql = "SELECT * FROM {invite} WHERE expiry > $xtimex && received = 0";
$result = db_num_rows(db_query($sql));
$pending = "<strong>Pending Invitations:</strong> $result";
$sql = "SELECT * FROM {invite} WHERE expiry < $xtimex && received = 0";
$result = db_num_rows(db_query($sql));
$expired = "<strong>Expired Invitations:</strong> $result";
$sql = "SELECT * FROM {invite} WHERE 1";
$result = db_num_rows(db_query($sql));
$total = "<strong>Total Invitations:</strong> $result";
echo "$accepted<br />$pending<br />$expired<br />$total";
Looking at this code now I suppose you could optimize it by just echo-ing your results instead of storing them to variables and displaying them later. Oh well--you get the idea.
Comments
Comment #1
smk-ka commentedIf you mean an admin page showing all invites then no, that's not implemented (yet). Would you be able to do it?
--
Stefan Kudwien
unleashed mind
Comment #2
ola90@drupal.ru commentedUnfortunately, I would not (yet). I'm a beginner.
Comment #3
smk-ka commentedA note for myself: evaluate if this can be done through Views support.
Comment #4
jcruz commentedI would be interested in this as well.
Comment #5
smk-ka commentedComment #6
smk-ka commentedComment #7
icecreamyou commentedI'm interested in this too. Doing it with views would be most flexible for administrators, but hardcoding it would allow for a "View all invitations" permission (of course, now that I think about it, individual views can be restricted to certain permission levels too). It doesn't seem to me that it would be difficult to add a hardcoded page--it would just be a few DB calls, and I think the code for this is already mostly existent anyway because each user already has their "Pending" page.
Comment #8
Fixer-1 commentedI've tried using views. I don't see the fields available to create a query on invitations. Am I missing something?
Comment #9
ekrispin commentedMeanwhile you can browse the table "invite" in the database and see who invited whom.
"email" field is the invitee. "uid" is the user id of the inviter.
Comment #10
icecreamyou commentedGood call, ekrispin, I should have thought of that earlier. Knowing that though it seems like it wouldn't be a big deal to just use some PHP on a page to show what's in the database... can we come up with that code here for a better temporary solution?
Comment #11
icecreamyou commentedIt looks like this module does what we're asking for: http://drupal.org/project/invite_site_report
I haven't tested it though.
If you just want a simple block to tell you accepted/pending/expired/total invites though, you can use this:
Looking at this code now I suppose you could optimize it by just echo-ing your results instead of storing them to variables and displaying them later. Oh well--you get the idea.
Comment #12
ckngCleaning out old issues.