Foreach Loop Not Display All Entries

I created a custom function on my WordPress site that has a Gravity Form (GF) form on the site where people can pledge to create groups. There are 7 fields on the form (Form ID #1):

  1. Name
  2. Email
  3. Organization Name
  4. Organization Address
  5. # of Weekday Groups
  6. # of Weekend Groups
  7. Total # of Groups (hidden)

The script requests for the leads from GF form #1 and runs it through a foreach loop which keeps added the value from field 7 until there are no entries left.

Read More

However, starting today the code is only gathering 30 entries from the form when there are currently 60. Please help.

function test_gf(){
 $pledges = RGFormsModel::get_leads('1');   // Form_id
    $group_count = 0;   // resets group_count
    $entries = 0;
        foreach ($pledges as $pledge) {
            $group_count += $pledge[7]; // Adds each value from Field #7 (Total)
            $entries++; // Checking the number of entries processed
        }

    // HTML Output
    echo '<h1>New Groups Pledged: '. $group_count . '</h1>' ;
    echo '<h2># of Entries Processed: '.$entries.'</h2>';
}

Related posts

Leave a Reply

1 comment