Lack of interest "Unsubscription Feedback" system for EmailStop

This suggestion has been closed automatically because it did not receive enough votes over an extended period of time. If you wish to see this, please search for an open suggestion and, if you don't find any, post a new one.

DragonByte Tech

Well-known member
Currently, there's no way for EmailStop handlers to ask users for feedback after unsubscription.

Asking for feedback is a very common tactic in email lists; you click unsubscribe, and you are instantly unsubscribed - but it says something like "You've been unsubscribed. You can now close this window, but if you want to tell us why you unsubscribed:" and then a list of options.

In order to achieve this now, we have to extend \XF\Pub\Controller\EmailStop and do the dreaded "full method replacement, something like:
PHP:
    public function actionIndex(ParameterBag $params)
    {
        if ($this->isPost())
        {
            $confirmKey = $this->filter('c', 'str');
            $emailStopper = $this->assertValidatedStopService($params->user_id, $confirmKey);
            
            $stopAction = $this->filter('stop', 'str');
            $parts = explode(':', $stopAction, 2);
            
            if ($parts[0] == 'dbtech_mail_mailinglist')
            {
                $emailStopper->stop($stopAction);
                
                $viewParams = [
                    'user' => $emailStopper->getUser(),
                    'confirmKey' => $emailStopper->getConfirmKey()
                ];
                return $this->view('DBTech\Mail:EmailStop\Feedback', 'dbtech_mail_unsubscribe_feedback', $viewParams);
            }
        }
        
        return parent::actionIndex($params);
    }
(Obviously quite incomplete 😛)

If this would be too much work for too little gain, it may be worth creating a new code event in that location that can intercept the return message and return an alternative message instead, by changing the return $this->message(\XF::phrase('your_email_notification_selections_have_been_updated')); line to store that message in a variable instead.

I would say that passing the controller ($this), the $stopAction variable, the $emailStopper service and the &$retval variable containing the message would be a good set of parameters.


Fillip
 
Upvote 3
This suggestion has been closed. Votes are no longer accepted.
For my What's New Digest addon, I generated a custom email stop URL:

Code:
    {{ phrase('whatsnewdigest_email_html_footer', {
        'board': $xf.options.boardTitle,
        'preferences_link': link('canonical:account/preferences'),
        'disable_this_link': link('canonical:email-stop/whatsnewdigest', $xf.toUser),
        'disable_all_link': link('canonical:email-stop/all', $xf.toUser)
    }) }}

... and then in my class extending \XF\Pub\Controller\EmailStop, I simply added:

PHP:
    public function actionWhatsNewDigest(ParameterBag $params)
    {
        return $this->displayConfirmation($params, ['whatsnewdigest']);
    }

The only time it would hit the index route is if someone changed the URL to remove the /whatsnewdigest or the /all component.

There's no reason I couldn't have added a custom displayConfirmation function for my addon to display a different message at that point.

Of course I also had to extend \XF\Service\User\EmailStop to handle the stop and stopAll actions

You can see my code here: https://bitbucket.org/hampel/whats-new-digest/src/master/
 
Top Bottom