Skip to main content

Add a Custom Section below the QR Code on the Subscriber Account Page

Free Beginner Since v1.0.0

Use benecaster_after_account_qr_code to append a section after all built-in account content. The action fires with ( int $show_id, int $user_id ). To insert before a built-in section instead, use the corresponding benecaster_before_* hook. All account hooks pass both $show_id and $user_id.

Code

<?php
add_action(
    'benecaster_after_account_qr_code',
    function ( int $show_id, int $user_id ): void {
        $history_url = add_query_arg(
            [ 'show' => $show_id, 'subscriber' => $user_id ],
            home_url( '/episode-history/' )
        );
        printf(
            '<div class="my-account-history"><h3>%s</h3><a href="%s">%s</a></div>',
            esc_html__( 'Your listening history', 'my-plugin' ),
            esc_url( $history_url ),
            esc_html__( 'View episodes you\'ve accessed →', 'my-plugin' )
        );
    },
    10,
    2
);

View on GitHub →

Hooks Used