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.

Undefined variable: assigned_channels

January 05, 2011 3:59am

Subscribe [8]
  • #1 / Jan 05, 2011 3:59am

    J3roen

    21 posts

    There seems to be a bug in cp/content_publish.php. (Build 20101220)

    The error is:

    A PHP Error was encountered
    Severity: Notice
    Message: Undefined variable: assigned_channels
    Filename: cp/content_publish.php
    Line Number: 2122

    As you can see in the function code there is no way for $assigned_channels to be set. If you are logged in as an admin it never get’s parsed and hence no error notice.

    FYI. I don’t have time to file a bug report, so I thought I’d post it here.

    /**
         * Build Channel Select Options Field
         *
         * @return     array
         */
        private function _build_channel_select()
        {
            $menu_channel_options     = array();
            $menu_channel_selected    = '';
            
            $query = $this->channel_model->get_channel_menu(
                                                            $this->_channel_data['status_group'], 
                                                            $this->_channel_data['cat_group'], 
                                                            $this->_channel_data['field_group']
                                                        );
    
            if ($query->num_rows() > 0)
            {
                foreach ($query->result_array() as $row)
                {
                    if ($this->session->userdata['group_id'] == 1 OR in_array($row['channel_id'], $assigned_channels))
                    {
                        if (isset($_POST['new_channel']) && is_numeric($_POST['new_channel']) && $_POST['new_channel'] == $row['channel_id'])
                        {
                            $menu_channel_selected = $row['channel_id'];
                        }
                        elseif ($this->_channel_data['channel_id'] == $row['channel_id'])
                        {
                            $menu_channel_selected =  $row['channel_id'];
                        }
    
                        $menu_channel_options[$row['channel_id']] = form_prep($row['channel_title']);
                    }
                }
            }
            
            $settings = array(
                'new_channel'    => array(
                    'field_id'                => 'new_channel',
                    'field_label'            => lang('channel'),
                    'field_required'        => 'n',
                    'field_instructions'    => '',
                    'field_type'            => 'select',
                    'field_pre_populate'    => 'n',
                    'field_text_direction'    => 'ltr',
                    'field_list_items'        => $menu_channel_options,
                    'field_data'            => $menu_channel_selected
                )
            );
    
            $this->api_channel_fields->set_settings('new_channel', $settings['new_channel']);
            return $settings['new_channel'];        
        }
  • #2 / Jan 05, 2011 4:03pm

    Ingmar

    29245 posts

    Thank you for your feedback. Personally you don’t need any help with that issue, I understand?

  • #3 / Jan 13, 2011 5:37am

    JLoft

    8 posts

    I am experiencing the same issue reported in this thread. If someone is logged in as something less than a super admin, then they encounter this PHP error.

    Is there a fix for this?

  • #4 / Jan 13, 2011 5:25pm

    Greg Salt

    3988 posts

    Hi JLoft,

    Would you mind submitting a bug report for this issue? Please make sure that provide a link back to this thread. You will then receive notifications as that report is updated.

    Cheers

    Greg

  • #5 / Jan 13, 2011 5:55pm

    JLoft

    8 posts

    I submitted a new bug report: https://support.ellislab.com/bugs/detail/15011/

    Then, I noticed that there was a bug report for this issue filed for release 2.1.2, and it was supposed to be fixed for 2.1.3. https://support.ellislab.com/bugs/detail/14902/

    Applying the temporary fix found in the replies to that bug report did resolve my problems in the control panel.

    This 2.1.2 bug report also appears to be similar, but it is labeled resolved for the 2.1.3 release.
    https://support.ellislab.com/bugs/detail/14794/

  • #6 / Jan 14, 2011 10:22am

    Ingmar

    29245 posts

    Thank your for your feedback, we appreciate it.

  • #7 / Jan 17, 2011 8:51pm

    Kurt Deutscher

    827 posts

    I can confirm that the bug does exist in 2.1.3. Glad its been reported.

  • #8 / Jan 18, 2011 4:05pm

    Ingmar

    29245 posts

    Very good. Thanks for your patience.

  • #9 / Apr 28, 2011 5:01am

    So, you’re saying that if I want someone to be able to publish content in EE, they have to be a super-admin ?

    Is there any way to work around this ? Because allowing clients to post content without them having access to all the other admin areas is pretty standard functionality in my opinion..

    Or has this issue been resolved in 2.1.4 ?

  • #10 / Apr 28, 2011 6:47am

    John Henry Donovan

    12339 posts

    Hi Jan,

    Issue has been fixed in beta but you can apply a fix yourself in EE2.1.3

    Let us know if that helps

  • #11 / Apr 28, 2011 10:49am

    Hi Jan,

    Issue has been fixed in beta but you can apply a fix yourself in EE2.1.3

    Let us know if that helps

    sweet, that worked great.
    Thanks.

  • #12 / Apr 28, 2011 1:52pm

    Brandon Jones

    5500 posts

    Glad that works, Jan! Since this is resolved in the 2.1.4 beta, going ahead and closing.

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

ExpressionEngine News!

#eecms, #events, #releases