【问题标题】:gravity forms api get_entries limited to 20重力形式 api get_entries 限制为 20
【发布时间】:2016-09-03 16:52:57
【问题描述】:

这似乎是一个极其简单的问题,但无论我如何切片,即使 GFAPI::count_entries() 返回 52,Gravity Forms 也只显示 20 个条目。

代码如下:

$form_id=16; 
$search_criteria = array( 'status' => 'active' );
$total_entries = GFAPI::count_entries( $form_id, $search_criteria );
echo '<h3>Count of entries: '.$total_entries.'</h4>';
// shows: Count of entries: 52 as expected

// great, now process each entry and get specific fields
$paging = array( 'offset' => 0, 'page_size' => 60 );
$allentries = GFAPI::get_entries( $form_id, $paging );
echo '<h3>Count of entries: '.count($allentries).'</h4>';
// shows: Count of entries: 20

$entryid = 25; // known data item
$firstEntry = GFAPI::get_entry( $entryid );
echo '<h4>Name for 25: '.$firstEntry[20].'</h4>';
// shows: Name for 25: Todd

$entryid = 189; // known data item
$midEntry = GFAPI::get_entry( $entryid );
echo '<h4>Name for 189: '.$midEntry[20].'</h4>';
// shows: Name for 189: Steve

$entryid = 525; // known data item
$lastEntry = GFAPI::get_entry( $entryid );
echo '<h4>Name for 525: '.$lastEntry[20].'</h4>';
// shows: Name for 525: Graylin

我已经添加了 $page 参数、$search 等,但没有任何效果...我只获得了最近提交的 20 条记录。

我的目标是循环访问条目以获取特定字段(例如,firstname=[20] 等)。

非常感谢这里的方向。

【问题讨论】:

    标签: wordpress plugins gravity-forms-plugin


    【解决方案1】:

    试试这个:

    $entries = GFAPI::get_entries( $form_id, $search_criteria, null, $paging );
    

    【讨论】:

    • 太棒了!那是秘密答案!
    • 这也回答了 $total_count 的另一个问题。据我所知,GFAPI 函数需要传递所有参数。有点奇怪,但重要的是要知道。非常感谢!!
    • 这里都有完整的文档记录:gravityhelp.com/documentation/article/api-functions/…
    猜你喜欢
    • 2017-08-15
    • 1970-01-01
    • 1970-01-01
    • 2022-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多