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

How to retrieve Trophy Title using Trophy ID

Discussion in 'XenForo Development Discussions' started by Rayman, Oct 7, 2014.

  1. Rayman

    Rayman Member

    Hi,

    I had a look through the MySQL Tables and I can't seem to find any way of finding the Trophy Title using the Trophy ID.

    I would appreciate any help on how I can retrieve the Trophy Title using the Trophy ID via MySQL or any other way.
     
  2. Mike

    Mike XenForo Developer Staff Member

    Trophy titles are phrase with names trophy_#_title where # is the ID.
     
  3. Rayman

    Rayman Member

    How would I go by searching the phrases for that particular phrase by just using the ID?

    Code:
            $trophyID = '11';
            $trophyTitle = new XenForo_Phrase('trophy_'.$trophyID.'');//Phrase object
            $trophyTitle = $trophyTitle->render(); //Phrase text
     
  4. Rayman

    Rayman Member

    I managed to find a default function that already does this:
    Code:
    $this->getTrophyMasterTitlePhraseValue($trophyId);
    However it throws the error "Call to undefined method" because of the "$this->" bit.

    Does anyone know what I have to do to get $this-> to work? It is my first add-on, so my apologies, this is all new to me :)

    Many thanks in-advance!!
     
    Last edited: Oct 13, 2014
  5. Rayman

    Rayman Member

    Resolved.

    Replaced "$this->" with:
    Code:
    XenForo_Model::create('XenForo_Model_Trophy')->
     

Share This Page