WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] need correction with a snippet regarding an array issue (3 posts)

  1. southcast
    Member
    Posted 1 year ago #

    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.

  2. southcast
    Member
    Posted 1 year ago #

    I guess it is just a minor issue of an array, I am not able to figure out...anybody up for a little help please?

  3. southcast
    Member
    Posted 1 year ago #

    Doesnot work. Taken an alternative route.

Topic Closed

This topic has been closed to new replies.

About this Topic