Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wpfullstripe/f4b8f8cbe4a264fec330150f260e4a2f to your computer and use it in GitHub Desktop.
Save wpfullstripe/f4b8f8cbe4a264fec330150f260e4a2f to your computer and use it in GitHub Desktop.
Display extra content at the top of the customer portal pane.
<?php
/**
* A 'fullstripe_customer_portal_header' filter hook example for WP Full Stripe.
*
* @param string $content Header content set by a previous filter instance.
* @param array $params with the following keys:
* email => Email address of the logged-in customer
* stripeCustomerId => Stripe customer id of the logged-in customer
* stripeClient => Instance of the \StripeWPFS\StripeClient object, intialized in the API mode selected in the plugin's settings
*
* @return string Filtered content
*/
function customerPortalHeader( $headerContent, $params ) {
$email = $params['email'];
$stripeCustomerId = $params['stripeCustomerId'];
$stripeClient = $params['stripeClient'];
$headerContent .= '<h3>Header</h3>';
$headerContent .= '<p>Email: ' . $email . '</p>';
$headerContent .= '<p>stripeCustomerId: ' . $stripeCustomerId . '</p>';
return $headerContent;
}
add_filter( 'fullstripe_customer_portal_header', 'customerPortalHeader', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment