Author Topic: Moving access levels order  (Read 848 times)

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Moving access levels order
« on: September 08, 2015, 03:30:44 PM »
I'd like to change the order of access level codes or move certain ones to other locations on the list of the plan-comparison-chart. Is it possible to do this?
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

KHDev

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 502
  • Karma: +43/-2
  • Etano Contributor (Skins & Mods)
    • KH Web Development
Re: Moving access levels order
« Reply #1 on: September 14, 2015, 05:57:08 AM »
One way to sort/order access levels in the chart would be to add a column to the access_levels table in your databse (example s_order)

Then give each a number  1,2,3,4, ect in the order of importance

then in plan-comparision-chart.php

add

Code: [Select]
ORDER BY `s_order` ASC
to the existing query.

This is the manual way so, if you add any new access_levels you'll need too manually give it a sort  number.

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Re: Moving access levels order
« Reply #2 on: September 14, 2015, 12:41:36 PM »
I manually modified the dsb_access_levels as KHDev suggested and then in the plan-comparison-chart.php code, I went to around line 35

found this code
Code: [Select]
$query="SELECT `level_diz`,`level` FROM `{$dbtable_prefix}access_levels` WHERE `level_code`<>'login' AND `is_visible`='0'";
Changed it to
Code: [Select]
$query="SELECT `level_diz`,`level` FROM `{$dbtable_prefix}access_levels` WHERE `level_code`<>'login' AND `is_visible`='0' ORDER BY `a_order`";
it works
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.

ajayuk

  • Active Member
  • ***
  • Posts: 65
  • Karma: +0/-0
Re: Moving access levels order
« Reply #3 on: September 14, 2015, 03:30:03 PM »
But that is for alphabetical order right? Just came to this issue funny enough so the info helped a lot! Thank you.

Marble

  • Global Moderator
  • Veteran Member
  • *****
  • Posts: 1004
  • Karma: +56/-7
Re: Moving access levels order
« Reply #4 on: September 14, 2015, 04:37:37 PM »
But that is for alphabetical order right? Just came to this issue funny enough so the info helped a lot! Thank you.

It's numerical order. The "a" in a_order is just my way of reminding myself that it's for access levels order. You can name the column anything you want.
I tried the code without the ASC (for ascending) to see if it would work and apparently it does.
ajayuk, I'm glad this topic was helpful for you. :)

Thanks to KHDev for the suggestions 
If you see that I'm logged in forever... it just means I turned the page on my browser and forgot to logout.