Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • in reply to: Unsubscribe help/defaults #145194
    Rumyan Tsekov
    Participant

    I can only guess, that your theme options set buttons to open in new window and the variables are lost?

    in reply to: Unsubscribe help/defaults #145181
    Rumyan Tsekov
    Participant

    Hey! Please, try opening Incognito window in your browser. Does it work there?

    in reply to: Unsubscribe help/defaults #143847
    Rumyan Tsekov
    Participant

    Yes. This work-around is for browsers. For emails, there are already shortcodes in curly brackets – well documented.

    Cheers 🙂

    in reply to: Unsubscribe help/defaults #143641
    Rumyan Tsekov
    Participant

    and just found out that if you need, can define to which list the subscriber should belong by adding: list=”Name_of_the_list”

    at this row: <div class=”tnp-field tnp-field-button”><input class=”tnp-submit” type=”submit” value=”Subscribe” list=”Name_of_the_list”>

    in reply to: Unsubscribe help/defaults #143608
    Rumyan Tsekov
    Participant

    Hey 🙂 Happy New Year!

    I am not a developer and this solution is my way of fixing things. I am customer as you, sharing my findings with others. In my case this code is inserted into the dashboard.php of my child theme and it works. Where are you trying to implement it?

    EDIT: one more thing to mention: when copying this code, HTML formatting replaces all ” an ‘ with wrong ones. Make sure to find-replace in Notepad for example all those 1st

    in reply to: Unsubscribe help/defaults #143562
    Rumyan Tsekov
    Participant

    In the spirit of the New Year’s miracles, I was able to find a temporary work-around and I am going to share it with others, if that is not a problem!

    In my case, I’m customizing woocommerce’s file dashboard.php by using a copy of the original file into my child theme’s folder (common practice to override anything in wordpress). My file is located at: wp-content/themes/oceanwp-child-theme-master/woocommerce/myaccount/dashboard.php (because I use the oceanwp theme).

    In this file, which is already part of the code, I have added the following code (below), which will create two buttons Subscribe and Unsubscribe in HTML.
    It is already available inside The Newsletter Plugin itself. Anyone can find it in -> List Building -> Subscription Form Fields, Buttons, Labels -> Code

    What I needed was the ability to pre-populate current user’s email in the text field, so I got the information from the wp database.

    Next, I extracted the unsubscribe link parameters from the database, by inspecting the unsubscribe link that every user receives in their email, generated the unsubscribe link in a string parameter and added it to the buttons.

    You can nest this code within any hooked .php file with a little bit of testing, so I hope someone may find it useful.

    <?php
    global $wpdb;

    $your_website_s_url = get_bloginfo(‘wpurl’);
    $current_user = wp_get_current_user();
    $current_user_s_email = $current_user->user_email;

    $tableName = $wpdb->prefix . ‘newsletter’;
    $the_newsletter_s_array = $wpdb->get_results( “SELECT * FROM {$tableName} WHERE email = ‘$current_user_s_email'”);

    foreach ( $the_newsletter_s_array as $subscriber_s_email ){
    $unsubscribe_link = $your_website_s_url . “/?na=uc&nk=” . $subscriber_s_email->id . “-” . $subscriber_s_email->token;
    }
    $subscribe_link = $your_website_s_url . “?na=s”;

    ?>

    <div class=”tnp tnp-subscription”>
    <form method=”post” action=”<?php echo $subscribe_link ?>” onsubmit=”return newsletter_check(this)”>

    <input type=”hidden” name=”nlang” value=””>
    <div class=”tnp-field tnp-field-email”><label>Email</label><input class=”tnp-email” type=”email” name=”ne” value=”<?php echo $current_user_s_email ?>” required></div>
    <div class=”tnp-field tnp-field-privacy”><label><input type=”checkbox” name=”ny” required class=”tnp-privacy”> By continuing, you accept the privacy policy</label></div>
    <div class=”tnp-field tnp-field-button”><input class=”tnp-submit” type=”submit” value=”Subscribe”>
    </div>
    </form>
    </div>

    <div class=”tnp tnp-subscription”>
    <form method=”post” action=”<?php echo $unsubscribe_link ?>” onsubmit=”return newsletter_check(this)”>
    <div class=”tnp-field tnp-field-button”><input class=”tnp-submit” type=”submit” value=”Unsubscribe”>
    </div>
    </form>
    </div>

    Please, try not to break your site 🙂 test it in a staging environment 1st!

    Happy New Year!

    in reply to: Unsubscribe help/defaults #143443
    Rumyan Tsekov
    Participant

    Hi, Happy New Year!

    I believe, in this year you will implement unsubscribe shortcode and/or link to implement on any page we need?

    The second wish is a hook, so that when some plugin deletes the user profile, because of the GDPR this will trigger user removal from the lists.

    Happy holidays!

Viewing 7 posts - 1 through 7 (of 7 total)