Skip to content

Conversation

@saifsultanc
Copy link
Contributor

Context

⛑️ Ticket(s): https://secure.helpscout.net/conversation/3093956084/90023

Summary

Appears like this:
Screenshot 2025-10-07 at 10 08 44 AM

To make it appear along side the entries table, like this:
Screenshot 2025-10-07 at 10 10 07 AM

An additional snippet would be required:

add_action( 'wp_footer', function() {
	// UPDATE: to your page slug.
	if ( ! is_page( 'page-slug' ) ) {
		return;
	}
	?>
	<script>
	document.addEventListener( 'DOMContentLoaded', function() {
		const exportLink = document.querySelector( '.gpeb-export-csv-link' );
		const entriesBlock = document.querySelector( '.wp-block-gp-entry-blocks-entries' );

		if ( exportLink && entriesBlock ) {
			entriesBlock.parentNode.insertBefore( exportLink, entriesBlock );
		}
	});
	</script>
	<?php
});

@saifsultanc saifsultanc merged commit cc0881c into master Oct 7, 2025
1 of 2 checks passed
@saifsultanc saifsultanc deleted the saif/add/90023-add-experiemntal-gpeb-export-entries branch October 7, 2025 04:42
@coderabbitai
Copy link

coderabbitai bot commented Oct 7, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds an experimental CSV export for Gravity Perks GP Entry Blocks by injecting a frontend “Download CSV” link on the Entries Table block and handling the request on template_redirect: validates nonce, finds the block context, configures fields from summary columns, generates the CSV via GF export utilities, streams it, logs errors, and cleans up.

Changes

Cohort / File(s) Summary
Experimental CSV export for GP Entry Blocks
experimental/gpeb-export-entries-csv.php
Adds frontend CSV download link (non-admin, non-REST), validates export requests via nonce, resolves entries/entries-table block context, initializes GF_Queryer, configures export fields from summary columns, generates CSV with Gravity Forms export utilities, streams file with headers, logs failures, cleans up temp file, and exits.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User (Browser)
  participant FE as WP Frontend (Public)
  participant H as Export Handler (template_redirect)
  participant B as Block Context Resolver
  participant GF as GF Export Utilities
  participant FS as Temp File
  participant R as HTTP Response

  U->>FE: Click "Download Entries as CSV" link
  FE->>H: GET /?gpeb_export=1&uuid=...&nonce=...
  H->>H: Validate nonce
  alt Nonce invalid
    H-->>R: 403/exit
  end
  H->>B: Locate parsed blocks (entries / entries-table)
  B-->>H: Block attributes + context
  H->>GF: Configure export (fields from summary columns)
  H->>GF: Start export (export_id)
  GF->>FS: Write CSV to temp file
  alt File ready
    H->>R: Set CSV headers + stream file
    H->>FS: Cleanup temp file
    H-->>U: Download CSV
  else Read failure
    H->>H: Log error
    H-->>R: 500/exit
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • veryspry
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch saif/add/90023-add-experiemntal-gpeb-export-entries

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 433b9b7 and 1b22f57.

📒 Files selected for processing (1)
  • experimental/gpeb-export-entries-csv.php (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants