Author Topic: [GUIDE] Add option to hide certain Access Levels from Comparison Chart  (Read 1026 times)

KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 514
  • Karma: +45/-2
  • Etano Contributor (Skins & Mods)
For those who want to hide selected Access Levels (NOT MEMBERSHIP LEVELS) Heres a quick guide on how to add that option into your admin panel :)

Access your database and go to the table dsb_access_levels
Then add a new column named is_visible with these values:
- type = TINYINT
- length/values = 1
- default = as defined then enter 0
- attributes = UNSIGNED
and save

Now, in admin/access_levels_addedit.php find
Code: [Select]

/*************** FIND THIS ON LINE 34 ***************/

if (!empty($access_levels['allow_na'])) {
$access_levels['allow_na']='checked="checked"';
}

/************** ADD THIS BELOW IT ****************/
if (!empty($access_levels['is_visible'])) {
$access_levels['is_visible']='checked="checked"';
}


Now in admin/skin/access_levels_addedit.html
Code: [Select]
/***************** FIND THIS ***************/
<tr>
<td class="label"><label for="allow_na">Allow not-approved?</label></td>
<td class="field {access_levels.error_allow_na}"><input type="checkbox" name="allow_na" id="allow_na" value="1" {access_levels.allow_na} tabindex="3" /><br /><p class="comment">Check this box if you want to allow not-approved members to access this feature.</p></td>

</tr>
/***************** ADD THIS BELOW IT ***************/
<tr>
<td class="label"><label for="is_visible">Hide in comparison chart?</label></td>
<td class="field {access_levels.error_is_visible}"><input type="checkbox" name="is_visible" id="is_visible" value="1" {access_levels.is_visible} tabindex="4" /><br /><p class="comment">Check this box if you want to hide it from the comparison chart</p></td>

</tr>

Now in includes/tables/access_levels.inc.php Replace the 2 lines that are in this file with
Code: [Select]
$access_levels_default['defaults']=array('level_id'=>0,'level_code'=>'','level_diz'=>'','level'=>0,'allow_na'=>0,'is_visible'=>0);
$access_levels_default['types']=array('level_id'=>FIELD_INT,'level_code'=>FIELD_TEXTFIELD,'level_diz'=>FIELD_TEXTFIELD,'level'=>FIELD_INT,'allow_na'=>FIELD_INT,'is_visible'=>FIELD_INT);


Now in plan-comparision-chart.php
Code: [Select]
/************** FIND THIS ON LINE 34 ************/

$query="SELECT `level_diz`,`level` FROM `{$dbtable_prefix}access_levels` WHERE `level_code`<>'login' ";

/************* CHANGE IT TO ********************/
$query="SELECT `level_diz`,`level` FROM `{$dbtable_prefix}access_levels` WHERE `level_code`<>'login' AND `is_visible`='0'";



And thats it! :)


Now when you create or edit a Access Level you will have the option to hide it from the comparison chart :)