hidden_hide_submit() doesn't use t() for $op values

emaylx - September 4, 2008 - 23:12
Project:Hidden
Version:5.x-2.2
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

When user will translate button default names from "Hide" and "Report"
to their own language, it will NOT work at all, see below what should be changed,
I believe it is too simple mistake/typo to submit patch.

function hidden_hide_submit($form_id, $form_values) {
  $op = (string)$form_values['op'];
  //if ($op == 'Hide') {
  if ($op == t('Hide')) {
    if (! user_access('mark as hidden')) {
      drupal_access_denied();
    }
  }
  //elseif ($op == 'Report') {
  elseif ($op == t('Report')) {
    if (! user_access('report for hiding')) {
      drupal_access_denied();
    }
  }

HTH
Bartek

#1

lmoccozet - November 14, 2008 - 14:56

You need also to change it again in the same function (line 1857):

  if ($op == t('Hide')) {
    if (_hidden_hidden_hide($nid, $cid, $uid, $rid, $public, $private)) {
      $msg = t('Hidden %type.', $t_args);
      _hidden_log(HIDDEN_LOG_HIDE, $msg, $type, $id, $rid, $public, $private);
      drupal_set_message($msg);
    }

L.M.

#2

ekes - November 14, 2008 - 17:02
Status:active» fixed

Cheers, committed these so they're in CVS and checked this is the only place $op contains $form_values.

#3

System Message - November 28, 2008 - 17:12
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.