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?

Comments

Thoor’s picture

Subscribe ... because I have exactly the same Problem

gatonero’s picture

Me too. Even deactivating, uninstalling and reanstalling doesn't solve it.

zio’s picture

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?

Excaliber’s picture

same problem here.. doenst work with normal users

Popolo-1’s picture

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

zio’s picture

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.

gatonero’s picture

Priority: Normal » Critical

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.

edalcin’s picture

Is it in English? Works with me if the Default language is "English"..... Which brings another issue, already reported.

lillywolf’s picture

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.

ij’s picture

same here, subscribing...

tpohlsch’s picture

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+

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)) {

...
tpohlsch’s picture

Status: Active » Needs review
StatusFileSize
new747 bytes

Changes suggested in #11 (so I'm not accused of being lazy, correct as that may be... :) )

geraldito’s picture

patch fixed that error for me and users with role "registered user" can send invitations. thanx

guldi’s picture

thanks mates, fixed it also for me.
now also possible to send invitations as guest.

kalbun’s picture

Great! Thank you, I fixed the problem in my site too (Italian/Romanian/English)

-- Kalbun

tpohlsch’s picture

Sure, no problem! :)

Stan.Ezersky’s picture

Thanks a lot for patch! It works for my project: Drupal 6.9 (English, Russian)

setvik’s picture

Title: only administrator can send invitations » Only administrator can send invitations on multilingual installation.
StatusFileSize
new608 bytes

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

sebzur’s picture

Thanks! Now Invite works perfect!

Aleksic’s picture

Thanks! Now Invite works perfect:D

invi’s picture

Great patch! It also fixes problem with no showing invite block for logged user.

geek-merlin’s picture

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.

jsmm’s picture

Same problem in Spanish, both for authenticated and anonymous user, not for admin. Will the patch be included in a new version? Thanks,

jmm

pal_ur’s picture

subscribe

ckng’s picture

StatusFileSize
new688 bytes

Patch #18 is incomplete though, as the $role_no_space was not defined, thus giving the default INVITE_UNLIMITED.

Updated the patch.

andypost’s picture

StatusFileSize
new4.98 KB

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

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Patch from author is the same so rtbc

http://drupal.org/node/443916#comment-1554810

andypost’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
andypost’s picture

Status: Closed (duplicate) » Reviewed & tested by the community
StatusFileSize
new6.21 KB

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...

smk-ka’s picture

Status: Reviewed & tested by the community » Fixed

Thanks, committed a slightly enhanced version that also takes care of upgraded D5 installations.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.