ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Order of statuses in a Safecracker form

September 19, 2012 10:34am

Subscribe [1]
  • #1 / Sep 19, 2012 10:34am

    Stephen T

    127 posts

    I’m running EE 2.5.2 and have a question about the order the statuses appear in a safecracker form.  I have 10 statuses assigned to a particular channel and I’ve created a safecracker form to allow certain people to update the status of an entry.  This all works great, but the problem is that the statuses don’t appear in the correct order in the dropdown menu on the safecracker form.  They do appear in the correct order in the control panel.

    It seems like in the safecracker form the statuses are ordered based on the order they were created, so it’s using the status_id number.  But in the control panel, the statuses are ordered based on the Status Order that has been set for that status in the CP.  Is there a way to change this?  Shouldn’t the statuses be pulled into the safecracker form based on the Status Order?

    Here’s the code I’m using in the safecracker form:

    {status_menu}
      <select name="status" id="status">
        {select_options}
      </select>
    {/status_menu}
  • #2 / Sep 21, 2012 1:11pm

    Kevin Smith

    4784 posts

    Hi Stephen,

    I think we can fix this right up. Find /system/expressionengine/models/channel_model.php, and look for get_channel_statuses() (on line 147 in EE 2.5.3). Change the code so that the entire model looks like this:

    function get_channel_statuses($status_group)
     {
      $this->db->where('group_id', $status_group);
      $this->db->order_by('status_order');
      return $this->db->get('statuses');
     }

    Fixed it up for me. Does that take care of things for you, too? I filed a bug on this and made sure the fix is in the next release of EE.

  • #3 / Sep 21, 2012 3:49pm

    Stephen T

    127 posts

    Hi Kevin,

    Yep, that seems to fix it.  Thanks for the fix and for filing the bug report.

    Thanks!
    Stephen

  • #4 / Sep 21, 2012 3:50pm

    Kevin Smith

    4784 posts

    Great! Glad I could get that fixed for you, Stephen. Have a good one.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases