1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 Editing a Smilie

Discussion in 'XenForo Questions and Support' started by silence, Nov 16, 2015.

  1. silence

    silence Well-Known Member

    When editing a smilie, I get this error:

    Code:
    Undefined index: title
    
        XenForo_Application::handlePhpError() in XenForo/Model/Smilie.php at line 342
        XenForo_Model_Smilie->getSmilieCategoryOptions() in XenForo/ControllerAdmin/Smilie.php at line 71
        XenForo_ControllerAdmin_Smilie->actionEdit() in XenForo/FrontController.php at line 351
        XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
        XenForo_FrontController->run() in /home/xeno/public_html/xenforo/admin.php at line 13
    
    The thing is, the xf_smilie table has the title column, so I'm confused as to why this error is occuring.

    Verifying file sums shows no issues so I'm confused as to what's causing the issue :(
     
  2. silence

    silence Well-Known Member

    Here is dumping categories:
    Code:
    array(5) {
      [0] => array(2) {
        ["smilie_category_id"] => int(0)
        ["display_order"] => int(0)
      }
      [1] => array(3) {
        ["smilie_category_id"] => int(1)
        ["display_order"] => int(1)
        ["title"] => object(XenForo_Phrase)#182 (4) {
          ["_phraseName":protected] => string(23) "smilie_category_1_title"
          ["_params":protected] => array(0) {
          }
          ["_insertParamsEscaped":protected] => bool(true)
          ["_phraseNameOnInvalid":protected] => bool(true)
        }
      }
      [2] => array(3) {
        ["smilie_category_id"] => int(2)
        ["display_order"] => int(2)
        ["title"] => object(XenForo_Phrase)#36 (4) {
          ["_phraseName":protected] => string(23) "smilie_category_2_title"
          ["_params":protected] => array(0) {
          }
          ["_insertParamsEscaped":protected] => bool(true)
          ["_phraseNameOnInvalid":protected] => bool(true)
        }
      }
      [3] => array(3) {
        ["smilie_category_id"] => int(3)
        ["display_order"] => int(3)
        ["title"] => object(XenForo_Phrase)#181 (4) {
          ["_phraseName":protected] => string(23) "smilie_category_3_title"
          ["_params":protected] => array(0) {
          }
          ["_insertParamsEscaped":protected] => bool(true)
          ["_phraseNameOnInvalid":protected] => bool(true)
        }
      }
      [4] => array(3) {
        ["smilie_category_id"] => int(4)
        ["display_order"] => int(3)
        ["title"] => object(XenForo_Phrase)#180 (4) {
          ["_phraseName":protected] => string(23) "smilie_category_4_title"
          ["_params":protected] => array(0) {
          }
          ["_insertParamsEscaped":protected] => bool(true)
          ["_phraseNameOnInvalid":protected] => bool(true)
        }
      }
     
  3. silence

    silence Well-Known Member

    Modifying prepareSmilieCategory fixes my issue:

    Code:
        public function prepareSmilieCategory(array $smilieCategory)
        {
            if (!empty($smilieCategory['smilie_category_id']))
            {
                $smilieCategory['title'] = new XenForo_Phrase($this->getSmilieCategoryTitlePhraseName($smilieCategory['smilie_category_id']));
            }
            else
            {
                $smilieCategory['title'] = new XenForo_Phrase('unknown');
            }
    
            return $smilieCategory;
        }
    
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    You shouldn't have to modify the code to resolve that.

    I can't reproduce it at all.

    Try rebuilding the master data to see if that resolves it.
     
  5. silence

    silence Well-Known Member

    Nope did not fix the issue.
     
  6. Mike

    Mike XenForo Developer Staff Member

    Sounds like you have a smilie category with no ID? (Or an ID of 0?) That shouldn't be possible unless it was inserted into the DB directly.
     
  7. silence

    silence Well-Known Member

    Yeah somehow I did D: I did not insert it manually so it's odd how it got there. It had a display_order of 0 as well. I removed it and all is well.
     

Share This Page