Groups Newsletters provides lots of sensible WordPress actions and filters that you can use to customize the system. It leverages custom post types and taxonomies to provide a system that any developer who is familiar with those concepts in WordPress can use, to provide a customized solution for their client.
Constants
GROUPS_NEWSLETTERS_RECAPTCHA_SECRET_KEY
The constant can be used to define the ReCAPTCHA secret key in your site’s wp-config.php.
Example:
define( 'GROUPS_NEWSLETTERS_RECAPTCHA_SECRET_KEY', 'xxxxxxxxxxxxxx' );
GROUPS_NEWSLETTERS_RECAPTCHA_SITE_KEY
The constant can be used to define the ReCAPTCHA site key in your site’s wp-config.php.
Example:
define( 'GROUPS_NEWSLETTERS_RECAPTCHA_SITE_KEY', 'xxxxxxxxxxxxxx' );
Actions
groups_newsletters_user_subscribed
This action is invoked after a user has subscribed to newsletters.
Parameters
$user_id intThe ID of the user that subscribed
groups_newsletters_user_unsubscribed
This action is invoked after a user has unsubscribed from newsletters.
Parameters
$user_id intThe ID of the user that unsubscribed
groups_newsletters_campaign_status_updated
This action is invoked after a campaign status changes.
Parameters
$new_status stringThe campaign new status$current_status stringThe campaign current status$post_id intThe campaign ID
groups_newsletters_subscriber_activated
This action is invoked when a subscription is activated.
Parameters
$subscriber objectThe subscriber data object that activated the subscription with properties:
subscriber_id intThe subscriber IDemail stringThe subscriber emailstatus boolThe subscriber statussubscribed datetimeThe date and time of the subscription activationhash stringThe subscriber unique hash key
groups_newsletters_subscriber_cancelled
This action is invoked when a subscription is cancelled.
Parameters
$subscriber objectThe subscriber data object that cancelled the subscription with properties:
subscriber_id intThe subscriber IDemail stringThe subscriber emailstatus boolThe subscriber statussubscribed datetimeThe date and time of the subscription cancellationhash stringThe subscriber unique hash key
groups_newsletters_deactivate
This action is invoked after the plugin is deactivated.
Parameters
$network_wide booleanIf the plugin is deactivated network-wide
Filters
groups_newsletters_get_subscribe_text
This filter allows to modify the label text for the subscription form.
Parameters
$text stringThe text used in the label, default value ‘Subscribe to our Newsletters’
Returns
string
groups_newsletters_newsletter_email_header
This filter allows to use custom header in the newsletter email.
Parameters
$header stringThe string to use for the header, default is empty string
Returns
string
groups_newsletters_newsletter_email_content
This filter allows to adjust the content in the newsletter email.
Parameters
$header stringThe string to use for the content, default is the render content based on email template
Returns
string
groups_newsletters_newsletter_email_footer
This filter allows to use custom footer in the newsletter email.
Parameters
$footer stringThe string to use for the footer, default is an empty string
Returns
string
groups_newsletters_newsletter_stories_orderby
This filter allows to change the order of stories in a newsletter.
Parameters
$orderby arrayThe array with order by parameters and keys
menu_order, default value ‘ASC’date, default value ‘DESC’
Returns
array
groups_newsletters_campaign_status_update
This filter allows to change the status of a newsletter campaign.
Parameters
$new_status stringThe new status to set for the campaign, allowed values are ‘pending’, ‘on-hold’, ‘running’, ‘executed’$current_statusThe current status of the campaign$post_id intThe campaign ID
Returns
string $new_status
groups_newsletters_register_form_opt_in
Allows to change the opt-in form HTML. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$register_form stringThe HTML for the form
Returns
string
groups_newsletters_activation_tokens
This filter should return the values for the tokens used in subscription activation emails, when subscribing to newsletters. This filter can be used to modify and add tokens.
Parameters
$tokens arrayof string indexed by token keys
activation_urlThat consists of the subscriber activation hash, the subscriber email address and the site URLemailThe subscriber emailsite_urlThe site URLsite_titleThe site title
Returns
string
groups_newsletters_activation_subject
Allows to change the subject of subscription activation email.
Parameters
$subject stringThe text to use for the subject, default text is ‘Please confirm your subscription’
Returns
string
groups_newsletters_activation_message
Allows to change the message of subscription activation email. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$message stringThe HTML message used
Returns
string
groups_newsletters_subscribe_form_prologue
Allows to add content in the subscription form right after the opening <form> tag. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe content added
Returns
string
groups_newsletters_subscribe_form_epilogue
Allows to add content in the subscription form right before the closing </form> tag. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe content added
Returns
string
groups_newsletters_subscribe_form_output
Allows to modify the subscription form output. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe form markup
Returns
string
groups_newsletters_unsubscribe_form_prologue
Allows to add content in the unsubscription form right after the opening <form> tag. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe content added
Returns
string
groups_newsletters_unsubscribe_form_epilogue
Allows to add content in the unsubscription form right before the closing </form> tag. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe content added
Returns
string
groups_newsletters_unsubscribe_form_output
Allows to modify the unsubscription form output. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe form markup
Returns
string
groups_newsletters_user_subscribe_form_prologue
Allows to add content in the user subscription form right after the opening <form> tag. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe content added
Returns
string
groups_newsletters_user_subscribe_form_epilogue
Allows to add content in the user subscription form right before the closing </form> tag. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe content added
Returns
string
groups_newsletters_user_unsubscribe_form_prologue
Allows to add content in the user unsubscription form right after the opening <form> tag. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe content added
Returns
string
groups_newsletters_user_unsubscribe_form_epilogue
Allows to add content in the user unsubscription form right before the closing </form> tag. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe content added
Returns
string
groups_newsletters_cancellation_tokens
This filter should return the values for the tokens used in subscription cancellation emails, when unsubscribing from newsletters. This filter can be used to modify and add tokens.
Parameters
$tokens arrayof string indexed by token keys
cancellation_urlThat consists of the subscriber activation hash, the subscriber email address and the site URLemailThe subscriber emailsite_urlThe site URLsite_titleThe site title
Returns
string
groups_newsletters_cancellation_subject
Allows to change the subject of subscription cancellation email.
Parameters
$subject stringThe text to use for the subject
Returns
string
groups_newsletters_cancellation_message
Allows to change the message of subscription deactivation email. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$message stringThe HTML message used
Returns
string
groups_newsletters_list_prologue
Allows to add content before the newsletters list. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe content added$options arrayof string indexed by option keys
show_count booleanDefault value trueorderby stringOne of the following options:name, slug, term_id, count, date, none. Default valuenameorder string ASCorDESC, default valueASCshow_option_none stringText message when there are no newslettersshow_empty booleanDefault value falseper_page intDefault value 10
Returns
string
groups_newsletters_list_content
Allows to modify the newsletters list content. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$content stringThe newsletters list$options arrayof string indexed by option keys
show_count booleanDefault value trueorderby stringOne of the following options:name, slug, term_id, count, date, none. Default valuenameorder string ASCorDESC, default valueASCshow_option_none stringText message when there are no newslettersshow_empty booleanDefault value falseper_page intDefault value 10
Returns
string
groups_newsletters_list_epilogue
Allows to add content after the newsletters list. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe content added$options arrayof string indexed by option keys
show_count booleanDefault value trueorderby stringOne of the following options:name, slug, term_id, count, date, none. Default valuenameorder string ASCorDESC, default valueASCshow_option_none stringText message when there are no newslettersshow_empty booleanDefault value falseper_page intDefault value 10
Returns
string
groups_newsletters_list_output
Allows to adjust the output of newsletters list container. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe newsletters list output$options arrayof string indexed by option keys
show_count booleanDefault value trueorderby stringOne of the following options:name, slug, term_id, count, date, none. Default valuenameorder string ASCorDESC, default valueASCshow_option_none stringText message when there are no newslettersshow_empty booleanDefault value falseper_page intDefault value 10
Returns
string
groups_newsletters_search_output
Allows to adjust the output of search form. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe search form output
Returns
string
groups_newsletters_get_search_form_add_story_post_type
Modify the search from to keep search among stories limited to the story post type.
Parameters
$enable booleanDefault valuetrue
Returns
boolean
groups_newsletters_get_search_form_info
Modify info text shown after the stories search form. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe text message, defaults to ”Searching in stories …’
Returns
string
groups_newsletters_get_search_form
Modify the stories search form. Use with caution as malformed HTML will corrupt the form displayed.
Parameters
$output stringThe form output
Returns
string
groups_newsletters_legacy_templates
Whether to enable the legacy templates, used in Groups Newsletters version 2.x.x.
Parameters
$enable booleanDefault valuefalse
Returns
boolean
Example: Add the following snippet to functions.php file of your active theme, to enable legacy templates.
add_filter( 'groups_newsletters_legacy_templates', '__return_true' );
groups_newsletters_template_base
Modify the templates base location. Please note that no trailing slash is needed.
Parameters
$output stringBase location, defaults to ‘groups-newsletters’
Returns
string
