Advertisement:

Author Topic: 2.0.2, useless permission title  (Read 2747 times)

Offline Kryzen

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,678
  • Gender: Male
2.0.2, useless permission title
« on: May 05, 2012, 04:57:54 AM »
G'day :) So I'm back again ;D When you disable the calendar or just don't enable it, the "select a permission" dropdown doesn't display the permissions of the calendar, but it does display "[Calendar]", which doesn't make sense when there are no permissions for it (as the calendar has been disabled). So far I've got no idea how to fix it, though. Using SMF 2.0.2, no mods installed :)

Offline NanoSector

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 9,932
  • Gender: Male
    • rick2288 on Facebook
    • Yoshi2889 on GitHub
    • Test Server
Re: 2.0.2, useless permission title
« Reply #1 on: May 05, 2012, 05:20:54 AM »
What "select a permission" dropdown are you talking about?
My Mods / Mod Builder - A tool to easily create mods / Support team member
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Offline Kryzen

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,678
  • Gender: Male
Re: 2.0.2, useless permission title
« Reply #2 on: May 05, 2012, 05:28:08 AM »
When you go to the manage permissions page, you see a list of groups and below that, you'll see some other things, like remove permissions and add permissions. I mean that one :)

Offline NanoSector

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 9,932
  • Gender: Male
    • rick2288 on Facebook
    • Yoshi2889 on GitHub
    • Test Server
Re: 2.0.2, useless permission title
« Reply #3 on: May 05, 2012, 05:31:27 AM »
Oh, that thing. Let me seek the code for it in a minute.
My Mods / Mod Builder - A tool to easily create mods / Support team member
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,161
  • Gender: Male
  • THERE'S JUST ME
Re: 2.0.2, useless permission title
« Reply #4 on: May 10, 2012, 12:28:08 PM »
mmm...
ManagePermissions.php
Code: (find) [Select]
ksort($context['permissions'][$permissionType]['columns']);
}

// Check we don't leave any empty groups - and mark hidden ones as such.
foreach ($context['permissions'][$permissionType]['columns'] as $column => $groups)
foreach ($groups as $id => $group)
{
if (empty($group['permissions']))
unset($context['permissions'][$permissionType]['columns'][$column][$id]);
else
{
$foundNonHidden = false;
foreach ($group['permissions'] as $permission)
if (empty($permission['hidden']))
$foundNonHidden = true;
if (!$foundNonHidden)
$context['permissions'][$permissionType]['columns'][$column][$id]['hidden'] = true;
}
}

Code: (replace with) [Select]
ksort($context['permissions'][$permissionType]['columns']);

// Check we don't leave any empty groups - and mark hidden ones as such.
foreach ($context['permissions'][$permissionType]['columns'] as $column => $groups)
foreach ($groups as $id => $group)
{
if (empty($group['permissions']))
unset($context['permissions'][$permissionType]['columns'][$column][$id]);
else
{
$foundNonHidden = false;
foreach ($group['permissions'] as $permission)
if (empty($permission['hidden']))
$foundNonHidden = true;
if (!$foundNonHidden)
$context['permissions'][$permissionType]['columns'][$column][$id]['hidden'] = true;
}
}
}

* emanuele hopes this doesn't break anything else...

* emanuele waits a bit before apply it. ::)


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline Kryzen

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,678
  • Gender: Male
Re: 2.0.2, useless permission title
« Reply #5 on: May 14, 2012, 10:25:05 AM »
Thanks for the patch. :) Applied and it works fine now :)

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,161
  • Gender: Male
  • THERE'S JUST ME
Re: 2.0.2, useless permission title
« Reply #6 on: June 17, 2012, 11:44:23 AM »
commit b6fb1aeb92c9651e72a972ee452680604a67b026
Date:   Sun Jun 17 2012

    Removed unnecessary permissions from the select a permission dropdown - thank Dr. Deejay for the report
 


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.