Customstyle deprecated messages

Looking for a little help here.  I updated Customstyle for elgg 1.8 but am receiving a couple of deprecated messages that i am unsure how to fix.  I am not a programmer or a coder so everything i do takes a lot of google and trial and error, but cant fix this.  I am sure the errors are coming from the code below:

    function get_custom_style_from_metadata($user, $metadata_name){
        $returnArray = false;
        $user = get_entity($user);
        $customstyle_object = $user->getObjects($metadata_name, 1, 0);
        $customConfig = get_metadata_for_entity($customstyle_object[0]->guid);
            foreach($customConfig as $metadataObject){
                $returnArray[$metadataObject['name']] = $metadataObject['value'];
        return $returnArray;        

i know the line "get_metadata_for_entity" is replaced by "elgg_get_metadata", but it needs some sort of array i believe and unsure of what it is looking for.  any help by someone who could tell me what this code needs to be current with elgg 1.8 would be great.  I am trying to learn this so any explaination would be great as i am not just looking for the code, i would like to understand how and why.....