Incorrect variable passed to t() function in node_access_example_node_access

Created on 18 April 2016, about 8 years ago
Updated 17 February 2023, over 1 year ago

Problem/Motivation

Around line 226 in the node_access_example.module file, specifically in the node_access_example_node_access function we have the following line of code:

    drupal_set_message(t('Access to node @nid allowed because requester name (@name) is specifically allowed', array('@name' => $node->name, '@uid' => $account->uid)));

There are two replacement variables in the translation string, namely @nid and @name, but the variable array being passed have a different set of variables, namely @name and @uid.

Proposed resolution

The @uid variable '@uid' => $account->uid) should be replaced with '@nid' => $node->nid

Remaining tasks

  • Correct Code
  • Submit and test patch
πŸ› Bug report
Status

Fixed

Version

1.0

Component

Node Access Example

Created by

πŸ‡ΏπŸ‡¦South Africa jpdippenaar

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024