<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Populate drop-down list with usernames</title>
		<link>https://legacy.forums.gravityhelp.com/topic/populate-drop-down-list-with-usernames</link>
		<description>Gravity Support Forums Topic: Populate drop-down list with usernames</description>
		<language>en-US</language>
		<pubDate>Tue, 21 Apr 2026 18:53:26 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/populate-drop-down-list-with-usernames" rel="self" type="application/rss+xml" />

		<item>
			<title>jorge ocampo on "Populate drop-down list with usernames"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populate-drop-down-list-with-usernames#post-237170</link>
			<pubDate>Sat, 04 May 2013 15:02:24 +0000</pubDate>
			<dc:creator>jorge ocampo</dc:creator>
			<guid isPermaLink="false">237170@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thank you chrishill123, this exactly what i was looking for!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "Populate drop-down list with usernames"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populate-drop-down-list-with-usernames#post-95823</link>
			<pubDate>Mon, 26 Nov 2012 15:03:47 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">95823@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Yeah, I saw your if statement and was like &#34;where did he define metas?&#34; Glad you got it sorted.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>chrishill123 on "Populate drop-down list with usernames"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populate-drop-down-list-with-usernames#post-95821</link>
			<pubDate>Mon, 26 Nov 2012 15:01:45 +0000</pubDate>
			<dc:creator>chrishill123</dc:creator>
			<guid isPermaLink="false">95821@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I AM STOOPID.  After debugging I realised I missed the 's' of 'metas'.&#60;/p&#62;
&#60;p&#62;Thanks for the reply.  Here is help for anyone else trying this.&#60;/p&#62;
&#60;p&#62;Here's an example of my fully working code to populate a dropdown box in Gravity forms with a list of user display names.&#60;/p&#62;
&#60;p&#62;Add this to functions.php&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;// This adds display names for all users to a drop down box on a gravity form.
add_filter(&#38;quot;gform_pre_render&#38;quot;, &#38;quot;populate_userdrop&#38;quot;);

//Note: when changing drop down values, we also need to use the gform_admin_pre_render so that the right values are displayed when editing the entry.
add_filter(&#38;quot;gform_admin_pre_render&#38;quot;, &#38;quot;populate_userdrop&#38;quot;);

function populate_userdrop($form){

    //only populating drop down for form id 1 - if editing this change to your own form ID
    if($form[&#38;quot;id&#38;quot;] != 1)

    return $form;

    //Creating item array.
    $items = array();
    // Get the custom field values stored in the array
	// If editing this lookup where you would like to get your data from
	// this example loads through all users of the website
    $metas = get_users();

if (is_array($metas))
{
// in this example we just load the display_name for each user into our drop-down field
foreach($metas as $meta)  $items[] = array(&#38;quot;value&#38;quot; =&#38;gt; $meta-&#38;gt;display_name, &#38;quot;text&#38;quot; =&#38;gt; $meta-&#38;gt;display_name);
}
    //Adding items to field id 1. Replace 1 with your actual field id. You can get the field id by looking at the input name in the markup.
    foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field)
        if($field[&#38;quot;id&#38;quot;] == 1){
            $field[&#38;quot;choices&#38;quot;] = $items;
        }

    return $form;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>David Peralty on "Populate drop-down list with usernames"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populate-drop-down-list-with-usernames#post-95820</link>
			<pubDate>Mon, 26 Nov 2012 15:00:35 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">95820@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Wait, did you figure this out? On your form, I see a dropdown with user names in it.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>chrishill123 on "Populate drop-down list with usernames"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populate-drop-down-list-with-usernames#post-95817</link>
			<pubDate>Mon, 26 Nov 2012 14:49:48 +0000</pubDate>
			<dc:creator>chrishill123</dc:creator>
			<guid isPermaLink="false">95817@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Here's the code I'm working on in functions.php&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;function populate_userdrop($form){

    //only populating drop down for form id 1
    if($form[&#38;quot;id&#38;quot;] != 1)

    return $form;

    //Creating item array.
    $items = array();
    // Get the custom field values stored in the array
    $meta = get_users();

if (is_array($metas))
{
foreach($metas as $meta)  $items[] = array(&#38;quot;value&#38;quot; =&#38;gt; $meta-&#38;gt;display_name, &#38;quot;text&#38;quot; =&#38;gt; $meta-&#38;gt;display_name);
}
    //Adding items to field id 1. Replace 1 with your actual field id. You can get the field id by looking at the input name in the markup.
    foreach($form[&#38;quot;fields&#38;quot;] as &#38;amp;$field)
        if($field[&#38;quot;id&#38;quot;] == 1){
            $field[&#38;quot;choices&#38;quot;] = $items;
        }

    return $form;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;All I've done on the form is allowed it to be dynamically populated.&#60;/p&#62;
&#60;p&#62;Here's the form in action - &#60;a href=&#34;http://ethicalincubator.com/BMentor/form-test/&#34; rel=&#34;nofollow&#34;&#62;http://ethicalincubator.com/BMentor/form-test/&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>chrishill123 on "Populate drop-down list with usernames"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/populate-drop-down-list-with-usernames#post-95808</link>
			<pubDate>Mon, 26 Nov 2012 14:03:50 +0000</pubDate>
			<dc:creator>chrishill123</dc:creator>
			<guid isPermaLink="false">95808@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;~I would like to be able to populate a drop down box with a list of all usernames&#60;br /&#62;
Possible?
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
