Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-14843

Improvement of get_permission_lang() for use formatted string in extension

    XMLWordPrintable

Details

    • Improvement
    • Status: Open (View Workflow)
    • Trivial
    • Resolution: Unresolved
    • 3.1.10, 3.2.0-RC1
    • None
    • ACP
    • None

    Description

      Hello

      For my QTE extension i want create a new permission for each attribute created (It's easier to mange users/groups permissions with phpBB permission system instead of create mine).

      So I could, in Group forum permissions, get something like this:

      Can use "Resolved" attribute: yes non never
      Can use "Deleted" attribute: yes non never

      For that, i need to use a single formatted language string like

      "Can use %s attribute"

      My problem ? see:

      In get_permission_lang() function:

      	public function get_permission_lang($permission)
      	{
      		return (isset($this->permissions[$permission]['lang'])) ? $this->user->lang($this->permissions[$permission]['lang']) : $this->user->lang('ACL_' . strtoupper($permission));
      	}
      

      In my case,

      $this->permissions[$permission]['lang']

      should be an array. Exemple in my listener:

      		$permissions += array(
      			// ACP
      			'f_attr_'.$row['attr_id'] => array('lang' => array('CAN_USE_ATTR', $row['attr_name']), 'cat' => 'qte'),
      		);
      

      I may be cheating by using

      		$permissions += array(
      			// ACP
      			'f_attr_'.$row['attr_id'] => array('lang' => $this->user->lang('CAN_USE_ATTR', $row['attr_name']), 'cat' => 'qte'),
      		);
      

      but... it's an ugly trick

      What do you think guys ?

      Attachments

        Activity

          People

            Unassigned Unassigned
            ErnadoO Erwan Nader
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: