• Resolved noobieboy

    (@noobieboy)


    Hello team!

    First of all, thanks for this wonderful plugin.
    I am using this plugin for exporting the entries in one of my website and the export functionality is working properly.
    But I observed that Entry ID in the exported list is not sequential number.
    Can I make it to start from 1 and continue till the last entry like 1,2,3 (more like a serial number)?

    I tried the gfexcel_field_value_{type} hook, but I couldn’t implement it properly. I was unable to find examples for this hook also.

    Could you please help me to sort this out? Can I use the same hook to serialize the Entry ID?
    I just want to show the entry id from 1 to n. I hope this Entry ID is the id of Gravity Form entry in database. I am okay to show the numbers different from the actual Entry ID

    It would be great if someone can guide or point out the steps I am missing.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Plugin Author Doeke Norg

    (@doekenorg)

    Hi @noobieboy,

    You were pretty close actually; but the meta fields have their own hook: gfexcel_meta_value_{field} (you can optionally add the form_id as the last part). So in your case something like this should work:

    // Initialize the counter outside the hook.
    $entry_count = 1;
    // Add a hook for the entry id. We pass the counter variable by
    // reference (the &) to be able to update the count in the callback.
    add_filter( 'gfexcel_meta_value_id', function () use ( &$entry_count ) {
    	// increase and return the count.
    	return $entry_count ++;
    } );

    Please note that this is only a simple counter for this particular download. A form has no unique form entries. There are only unique entries over ALL forms; thats why the entry ids are not sequential. If you remove an entries somewhere in between, the count will not suddenly skip that number.

    In any case; I hope this helps you out.

    Kind regards,

    Doeke
    GravityKit

Viewing 1 replies (of 1 total)
  • The topic ‘How to use the hooks properly’ is closed to new replies.