Subscribe-by-email plugin, Unsubscribe link not working

Hi.
I wrote a template for the footer and am having trouble with the unsubscribe link. I can't figure out why it results in an empty string (vardump gives: string(0)).
The page is correctly setup. See screenshot. I even checked the result of the sbe_get_manage_subscriptions_page_id() function and it's all good.
Could you help me understand why the function does not return the link?

">
Unsubscribe

  • Predrag Dubajic

    Hey @Matthew,

    Hope you're doing well today :slight_smile:

    So you made changes to footer.php in plugin templates and it's not working after that, did I understood that correctly?

    If yes, could you zip the file and attach it here or use pastebin.com so we can see if there is anything missing from the file?

    If I missed your question please give us some more info regarding this :slight_smile:

    Best regards,
    Predrag

  • Matthew

    Wow this is getting tricky.
    My first test subscriber was with a Gmail account.
    I added a second subscriber with a Hotmail account. And it works perfectly with the Hotmail account (see screenshot1).
    But with the Gmail account: I can click on the unsubscribe link (not really sure why the function now outputs the link though), but it display a blank page (see screenshot2).

    Would you have any idea? the URLs both look valid.

  • Adam Czajczyk

    Hey Matthew,

    I hope you're well today!

    I took a look at your code and compared it with original footer.php template.

    Here's an original code:

    <?php if ( sbe_get_manage_subscriptions_page_id() ): ?>
    												<?php printf( __( 'To manage your subscriptions, <a href="%s">click here</a>.', INCSUB_SBE_LANG_DOMAIN ), esc_url( sbe_email_template_get_manage_subscriptions_url() ) ); ?> <br/>
    											<?php endif; ?>

    Here's the same code modified to follow your code:

    <?php
    if ( sbe_get_manage_subscriptions_page_id() ): ?>
    <a href="<?php echo esc_url( sbe_email_template_get_manage_subscriptions_url() ); ?>" style="color:#979797;" data-color="Footer Link">Manage subscriptions</a>
    <br/>
    <?php endif; ?>
    <a href="<?php echo esc_url( sbe_email_template_get_unsubscribe_url() );?>" style="color:#979797;" data-color="Footer Link">Unsubscribe</a>

    Please note the difference here:

    1. The function that prints an "unsubscribe" link is "sbe_email_template_get_unsubscribe_url()"
    2. The "sbe_email_template_get_manage_subscriptions_url()" function will not return any URL in case there's no subscription, meaning that either if the subscription is not confirmed yet or it simply doesn't exist - there'll be no URL returned.

    It's possible that I'm giving you basics here and you've already tested it but you only shared a single line of code. That said, if this is not an issue here, could you please share entire template file code so I could take another look and possibly test it on my sandbox?

    Cheers,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.