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.

Total Entry Count Not Specific to User Login

  1. asmeets
    Member

    I've been using the following code to query Gravity Forms entries on a specific form:

    [php]
    $user_info = get_userdata( $current_user->ID );
    $user_info = $user_info->user_login;
    $entry_count = RGFormsModel::get_lead_count(2, $user_info);
    <?php if ($entry_count > 0) { code hidden here... }; ?>

    The code does not appear to discriminate between users tree and tree1 or tree2 or tree3. Is there a location in the code that I should make this explicit?

    Posted 8 years ago on Tuesday January 22, 2013 | Permalink
  2. RGFormsModel::get_lead_count uses your $user_info parameter as a search, not a SELECT, so it will return tree, tree1, teatree, etc.

    From the source:

    public static function get_lead_count($form_id, $search, $star=null, $read=null, $start_date=null, $end_date=null, $status=null)

    You will have to check the field in your entry to be sure it matches $user_info exactly. You did not show the code you are using, so I'm not sure if you can check later, after the if statement, or if you will have to check before, right after retrieving the entries.

    Posted 8 years ago on Tuesday January 29, 2013 | Permalink