Support » Plugins and Hacks » need correction with a snippet regarding an array issue

  • Resolved southcast

    (@southcast)


    I am a newbie. I use gravity forms and wp-favorites plugin ( helps users select their favorite posts). I am trying to auto-populate gravity form with the following snippet. It works pretty well but it shows only the first item in the list. Someone please suggest a correction in order to get all the items in the array.

    add_filter("gform_field_value_selection", "populate_selection");
    function populate_selection ($value) {
       	$favs = wpfp_get_users_favorites();
            foreach ($favs as $fav){
    	$list = get_the_title($fav);
            return $list ;
    }
    }

    This snippet shows me the title of the first selected post only. I would like to get a list of all the selected posts, how do I acheive that ? I guess someone good with arrays could guide me to the right direction.
    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘need correction with a snippet regarding an array issue’ is closed to new replies.