PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

gform_get_meta not working?

  1. When I try to use gform_get_meta within a plugin shortcode function it is returning empty.

    For example:

    $entry_id = intval($userinfo['last_order_id'][0]);
    $create_date = gform_get_meta($entry_id, 'date_created');
    
    $result .= "<p>Your $entry_id create date is $create_date.</p>";

    $create_date is empty. Any ideas what I could be doing wrong here? The entry_id does output properly in the result.

    I have verified that the form entry id is valid by viewing the entry - e.g. here is the entry Info for 146:

    Entry Id: 146
    Submitted on: 2012/08/21 at 9:46 am
    User IP: 142.177.17.120
    User: testmommy29@sunriseweb.ca
    Embed Url: .../checkout
    Subscription Status: Active
    Start Date: 2012/08/21
    Subscriber Id: I-7CV0D31TRTLH
    Subscription Amount: $25.00

    Posted 11 years ago on Tuesday August 21, 2012 | Permalink
  2. @Brad, how are you trying to get this information? What plugin shortcode are you using?

    If $create_date is empty, can you verify the value of $entry_id before trying gform_get_meta? I'm not sure how all your pieces fit together just yet.

    Posted 11 years ago on Wednesday August 22, 2012 | Permalink
  3. @Chris thanks for your reponse. Here is code that fails for me (whether I place it in a plugin or in a theme's functions.php file).

    function mf_test_gform_get_meta() {
      extract(shortcode_atts(array(
          'entry_id' => '146'
       ), $atts));
      $entry_id = intval($entry_id); //get id of entry for most recent order form submitted
      $create_date = gform_get_meta($entry_id, 'date_created');
      $result .= "<p>Your $entry_id create date is $create_date.</p>";
      return $result;
    }
    add_shortcode('test_gform_get_meta', 'mf_test_gform_get_meta');

    Can you verify that it works for you? Also would love to hear a suggestion as the best way to validate an entry_id.

    Posted 11 years ago on Wednesday August 22, 2012 | Permalink
  4. What does the shortcode you're using look like? The one which utilizes this function?

    Posted 11 years ago on Wednesday August 22, 2012 | Permalink
  5. [test_gform_get_meta] if I want to use the default 146 that I know exists or

    [test_gform_get_meta entry_id=###] to specify the entry to use (e.g. [test_gform_get_meta entry_id=141] )

    My suggestion is that you install this and try it with an existing entry id from your Gravity Forms installation to see if it works for you.

    Posted 11 years ago on Wednesday August 22, 2012 | Permalink
  6. Did you get a chance to confirm that the gform_get_meta function is indeed working?

    Posted 11 years ago on Monday September 10, 2012 | Permalink