Hi @all,

I just wanted to report a little problem with the abuse module: When you translate the "report abuse" permission constant, you are not able to report nodes anymore. I think this is because the appropriate t()-functions are missing.

Cheers

hctom

Comments

btmash’s picture

Thanks for letting me know about this hctom; I'll issue a patch for it over the next couple of days.

btmash’s picture

I just realized...I don't know if I'm doing something wrong exactly. I've taken a look at how other modules handle user access and it doesn't seem like there should be any differences. Anyone else have thoughts on this?

archetwist’s picture

It's pretty simple. In your module you have

define('REPORT_ABUSE', 'report abuse');
define('ADMINISTER_ABUSE_REPORTS', 'administer abuse reports');
define('DIRECT_FLAG', 'direct flag');

/**
 * Implementation of hook_perm
 */
function abuse_perm() {
  return array(REPORT_ABUSE, ADMINISTER_ABUSE_REPORTS, DIRECT_FLAG);
}

and it should be just

/**
 * Implementation of hook_perm
 */
function abuse_perm() {
  return array('report abuse', 'administer abuse reports', 'direct flag');
}
archetwist’s picture

Also, when you construct a link you do l(t('Reason configuration settings'), 'admin/settings/abuse/reasons'), not l('Reason configuration settings', 'admin/settings/abuse/reasons') (notice the missing t('')).

hctom’s picture

Just a little follow up: You can of course use :

define('REPORT_ABUSE', t('report abuse'));
define('ADMINISTER_ABUSE_REPORTS', t('administer abuse reports'));
define('DIRECT_FLAG', t('direct flag'));

/**
* Implementation of hook_perm
*/
function abuse_perm() {
  return array(REPORT_ABUSE, ADMINISTER_ABUSE_REPORTS, DIRECT_FLAG);
}

...notice the t()-functions, which are missing in your constant declaration code.

cheers

hctom

hctom’s picture

after thinking a bit about my previou spost, I'm not quite sure if the translation is really needed for module permissions, as I also checked some other modules where this is not done at all... So I think: just ignore my last post :-)

cheers

hctom

archetwist’s picture

You could as well state there is no need to translate any other part of the admin UI...

mightyiam’s picture

Not being able to translate is one thing, and trying to translate and ending up with something broken is a bug.

archetwist’s picture

Status: Active » Closed (fixed)

I guess nobody cares.