[e-Newsletter Plugin] Shortcode to display subscriber count

All of the other WordPress Newsletter plugins (Mailster, Mailpoet, MailChimp, etc) have the option to display a subscriber count anywhere via a shortcode?

How can I do this with the eNewsletter plugin?

  • Predrag Dubajic
    • Support

    Hi Glenton,

    I’m afraid that this is not something currently possible but it does sound like an interesting addition so I would like to move this from our Members forum to Features & Feedback section.

    I’ll also ping devs to see if we could provide a quick workaround with a simple shortcode to show the number of subscribers :slight_smile:

    Best regards,

    Predrag

  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hi Glenton !

    You can add this code snippet on your themes functions.php ( preferably the child themes ) and it will create a shortcode that returns the subscribers count. You can use the [enl-members-count] shortcode after you’ve added the code anywhere in the front-end.

    add_shortcode( 'enl-members-count', 'count_newsletter_members' );
    function count_newsletter_members() {
    $count = 'Could not find E-Newsletter plugin';

    if ( class_exists( 'Email_Newsletter_functions' ) ) {
    global $wpdb;
    $count = $wpdb->get_var( "SELECT Count(member_id) FROM {$wpdb->prefix}enewsletter_members WHERE unsubscribe_code != ''" );
    return $count;
    }

    return $count;
    }

    Tell me if you need any further help or customization with this !

    Regards,

    Konstantinos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.