Only administrator can send invitations on multilingual installation.
zio - October 17, 2008 - 18:22
| Project: | Invite |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Description
The "registered user" role always have a "Sorry, you've reached the maximum number of invitations" message when attempting to send invitation. (Even with "unlimited" number option enabled for this role). What is this?

#1
Subscribe ... because I have exactly the same Problem
#2
Me too. Even deactivating, uninstalling and reanstalling doesn't solve it.
#3
I don't understand: in invite.install there is function for schema update - invite_maxnum_ should be in permissions table. But there are no such entry in permissions. Reinstalling and update.php don't help. What else?
#4
same problem here.. doenst work with normal users
#5
I got the same issue and found a way around (the issue could be linked to a translation matter).
I have a site in French and therefore the 2 following strings are translated as follow.
- 'anonymous user' --> 'visiteur anonyme'
- 'authenticated user' --> 'visiteur identifié'.
I had to translate these 2 strings back in English over the translation interface:
- 'visiteur anonyme' --> 'anonymous user'
- 'visiteur identifié' --> 'authenticated user'
and this solved the issue.
I am using D6 and module Invite 6.x-2.x-dev
#6
very interesting! How this trick can work? In db schema roles are coded in two different tables and there are no relations to translation.
But.... it's work for me also.
I hope that somebody can find and fix this tiny bug.
#7
This workes for me too. Now I'm using this modul again because I like, that's possible to personalize the invitation. Because I didn't use the modul before this workarround and I'm using it now with this provisorium I set priority to critical.
#8
Is it in English? Works with me if the Default language is "English"..... Which brings another issue, already reported.
#9
So this can also be fixed by creating a new role, giving that role the appropriate invite permissions, and then assigning that role to your users. For some reason, though, just giving authenticated users the right invite permissions isn't working.
#10
same here, subscribing...
#11
The roles array in the $account object is not (fully) localized (since the default "registered" role is manually added to the array, it's always called "authenticated user"). So simple localization of the roles in $account->roles does the trick.
Disclaimer: While this works well for me on a site with German localization, and IMHO should (tm) work on "real" multi-lingual sites, I have not thoroughly tested this. The bit of code below is exactly what it says it is: a QUICK fix.
Quick fix:
.../modules/invite/invite.module, line 655+
<?php
function invite_get_role_limit($account) {
if (!isset($account->roles)) {
$account = user_load(array('uid' => $account->uid));
}
// localize roles
$roles_loc = array();
foreach($account->roles as $role) {
$roles_loc[] = t($role);
}
$role_limit = 0;
foreach (user_roles(0, 'send invitations') as $role) {
$role_no_space = str_replace(' ', '_', $role);
if (in_array($role, $roles_loc)) {
...
?>
#12
Changes suggested in #11 (so I'm not accused of being lazy, correct as that may be... :) )
#13
patch fixed that error for me and users with role "registered user" can send invitations. thanx
#14
thanks mates, fixed it also for me.
now also possible to send invitations as guest.
#15
Great! Thank you, I fixed the problem in my site too (Italian/Romanian/English)
-- Kalbun
#16
Sure, no problem! :)
#17
Thanks a lot for patch! It works for my project: Drupal 6.9 (English, Russian)
#18
Building on tpohlsch's patch above, I think we can simplify the code a bit by comparing the role IDs instead of the role names which has the added bonus of avoiding the translation issue altogether.
References:
sess_read() in session.inc
user_roles() in user.module
invite_get_role_limit() in invite.module
#19
Thanks! Now Invite works perfect!
#20
Thanks! Now Invite works perfect:D
#21
Great patch! It also fixes problem with no showing invite block for logged user.
#22
patch #11 does the job for me.
@setvik, the direction you go "feels better" for me.
but if i review your patch right, the result uses the $role_no_space variable, without setting it. which gives "unlimited" for all inviters.
#23
Same problem in Spanish, both for authenticated and anonymous user, not for admin. Will the patch be included in a new version? Thanks,
jmm
#24
subscribe
#25
Patch #18 is incomplete though, as the $role_no_space was not defined, thus giving the default INVITE_UNLIMITED.
Updated the patch.
#26
Suppose better to change variable format to store role_id against role_name which is always translatable for $rid=2.
Marked as duplicate http://drupal.org/node/338005#comment-1849252 - read this comments
Limit is not only one place where this used so here patch with upgrade path and different variable names
#27
Patch from author is the same so rtbc
http://drupal.org/node/443916#comment-1554810
#28
Better mark this duplicate of #443916: Using role-names instead of ids caused problems with other languages
#29
This patch more complex so I add upgrade path and mark as duplicate #443916: Using role-names instead of ids caused problems with other languages
Sorry for buzz of my comments...
#30
Thanks, committed a slightly enhanced version that also takes care of upgraded D5 installations.
#31
Automatically closed -- issue fixed for 2 weeks with no activity.