Change FluentCRM unsubscribe text, reasons & response

tdrayson

A user in the FluentCRM Facebook group wanted a way to change the headings and text on the unsubscribe page.

After having a look through the source code, I found that there was a filter that can be used to update the text that shows up.

Unsubscribe text

If you want to change the overall text including headings, descriptions, labels etc. You can do that with the code below.


        <?php

/*
 * update_fluentcrm_unsubscribe_texts
 *
 * @function Change the usubscribe text for FluentCRM
 * @author Taylor Drayson
 * @since 12/02/2022
 * @tutorial https://snippetclub.com/change-fluentcrm-unsubscribe-text/
*/

add_filter( 'fluent_crm/unsubscribe_texts', 'update_fluentcrm_unsubscribe_texts' );
function update_fluentcrm_unsubscribe_texts( $messages ) {
    
    $messages['heading_description'] = 'this is my new heading';

    return $messages;
}
      
Copy

Default text and keys

Below is the list of the keys and the default texts that are currently set. To change them, use the example above and add your own by replacing the key inside the brackets. $messages['KEY_HERE']

  • heading – “Unsubscribe”
  • heading_description – “We’re sorry to see you go! Enter your email address to unsubscribe from this list.”
  • email_label – “Your Email Address”
  • reason_label – “Please let us know a reason”
  • button_text – “Unsubscribe”

Unsubscribe reasons

If you want to change the reasons or add more reasons to the list, you can do that with the code below.


        <?php

/*
 * update_fluentcrm_unsubscribe_reasons
 *
 * @function Change the usubscribe reasons for FluentCRM
 * @author Taylor Drayson
 * @since 12/02/2022
 * @tutorial https://snippetclub.com/change-fluentcrm-unsubscribe-text/
*/

add_filter( 'fluent_crm/unsubscribe_reasons', 'update_fluentcrm_unsubscribe_reasons' );
function update_fluentcrm_unsubscribe_reasons( $reasons ) {
    
    $reasons['not_relevant'] = 'Emails are not relevant anymore';

    return $reasons;
}
      
Copy

Default text and keys

Below is the list of the keys and the default reasons that are currently set. To change or add new ones, use the example above and add your own by replacing the key inside the brackets. $reasons['KEY_HERE']

  • no_loger – “I no longer want to receive these emails”
  • never_signed_up – “I never signed up for this email list”
  • emails_inappropriate – “The emails are inappropriate”
  • emails_spam – “The emails are spam”

Unsubscribe message response

If you want to update the response message after a reason has been changed, you can do that with the code below.


        <?php

/*
 * update_fluentcrm_unsubscribe_response
 *
 * @function Change the response after usubscribed for FluentCRM
 * @author Taylor Drayson
 * @since 12/02/2022
 * @tutorial https://snippetclub.com/change-fluentcrm-unsubscribe-text/
*/

add_filter( 'fluent_crm/unsub_response_message', 'update_fluentcrm_unsubscribe_response' );
function update_fluentcrm_unsubscribe_response( $message ) {
    
    $message = 'Sorry to see you go, hope you will be back soon';

    return $message;
}
      
Copy

Default response

Below is the default response that is currently set. To change use the example above and replacing the string for $message variable.

  • message – “You are successfully unsubscribed from the email list”

Resources

/fluent-crm/app/Hooks/Handlers/ExternalPages.php

👋🏻 Weekly Tutorial Digest

I send out a weekly newsletter with links to new tutorials written in the last week, you can subscribe below.

Newsletter

🔒I won't send you spam, I promise