Archived topic
WC Follow Ups with GP issue
8 replies · Started by Scott on January 22, 2023
When a user is logged in there is a link about subscriptions at ghe very bottom of the My Account page.
It appears un-styled. I contacted Woo Support but they said it was a GP issue and would not help.
This is what it looks like
That is called from the Woocommerce My Account page link the Follow Ups plugin adds (/my-account/?email-preferences)
Anyway, I know how to get rid of the widget but I have no idea how to add padding to the left so the “Email Subscriptions” and
“There are currently no mailing list to manage.” text isn’t sitting right up to the edge on the left side.
They told me GP has too many built in template overrides and that was the problem.
Any help appreciated.
Hi there,
funny thing is, we don't override any templates :)
We hook in some Woo functionality and we add some styles but we don't replace their templates.
But anyhow ... could i get a login where i can see this tab ?
certainly. Keys to the ranch are in the private Info area.
Hmmm... so the body classes state its using the page template, but its quite different to GPs.
Theres additional HTML and theres missing HTML. So i am not sure what its loading there,
If you want to find out, you could install the Query Monitor plugin, and that can show which template its using.
Alternatively we just accept its not right and throw some CSS at that specific page.
But as that page is an endpoint of the /account URL it has no specific body class.
To get around that we could use the body_class filter and some of woos funtions to add a class:
add_filter( 'body_class', function( $classes ) {
if ( ! function_exists( 'is_wc_endpoint_url' ) ) {
// bail out if WC is not loaded
return $classes;
}
if ( is_wc_endpoint_url( 'email-preferences' ) ) {
// if end point is email preferences
$classes[] = 'wc-email-prefs';
}
return $classes;
} );
If that works, then on that page we should see the wc-email-prefs class in the body tag.
Which can use in the CSS eg.
.wc-email-prefs .container {
background-color: #fff;
}
.wc-email-prefs .page {
padding: 40px;
}
I’ll try this and report back.
If all else fails I can disallow user mgmt of list subscriptions on the My Account page as they have it an just include their shortcode for signups directly in the template just like I did for the form and the woocommerce tracking feature.
I found a dashboard.css file with not much in it:
#fue-dashboard ul li {
padding: 0;
margin: -10px 15px -16px 25px;
}
#fue-donuts {
margin: 0;
}
#fue-donuts li {
float: left;
width: 200px;
font-size: 11px;
padding: 5px 0;
margin: 0 10px;
min-height: 45px;
}
#fue-dashboard ul li:hover {
color: #0074a2;
}
#fue-dashboard ul li span.dashicons {
float: left;
font-size: 35px;
width: 60px;
}
#fue-dashboard ul li strong {
font-size: 24px;
display: block;
}
I found there are two templates in /wp-content/plugins/woocommerce-follow-up-emails/templates/myaccount
1st one:
<div class="follow-up-subscriptions">
<h2><?php echo wp_kses_post( get_option( 'fue_email_subscriptions_page_title', 'Email Subscriptions' ) ); ?></h2>
<a href="<?php echo esc_url( add_query_arg( get_option( 'fue_email_preferences_endpoint', 'email-preferences' ), '', get_permalink( get_option('woocommerce_myaccount_page_id') ) ) ); ?>">
<?php esc_html_e('Manage email subscriptions', 'follow_up_emails'); ?>
</a>
</div>
2nd one:
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
if ( ! is_user_logged_in() ) {
$email_preferences = get_option( 'fue_email_preferences_endpoint', 'email-preferences' );
wp_safe_redirect( fue_get_login_url( site_url( "/$email_preferences" ) ) );
exit;
}
$me = wp_get_current_user();
$newsletter = new FUE_Newsletter();
$public_lists = $newsletter->get_public_lists();
$subscriber = $newsletter->get_subscriber( $me->user_email );
$subscriber_lists = array();
if ( ! empty( $subscriber['lists'] ) ) {
foreach ( $subscriber['lists'] as $list ) {
$subscriber_lists[] = $list['id'];
}
}
get_header(); ?>
<div class="wrap">
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<article class="page type-page status-publish hentry">
<header class="entry-header">
<h1 class="entry-title"><?php echo wp_kses_post( get_option( 'fue_email_subscriptions_page_title', 'Email Subscriptions' ) ); ?></h1>
</header>
<div class="entry-content">
<div class="follow-up-subscriptions">
<div class="fue-subscriptions-message hidden fue-success">
<p><span class="dashicons dashicons-yes"></span> <?php esc_html_e('Saved', 'follow_up_emails'); ?></p>
</div>
<?php
if ( empty( $public_lists ) ) {
echo '<p>' . esc_html__( 'There are currently no mailing list to manage.', 'follow_up_emails' ) . '</p>';
} else {
?>
<form id="fue-subscriptions-form" action="" method="post">
<ul class="follow-up-lists">
<?php foreach ( $public_lists as $list ): ?>
<li class="list-<?php echo esc_attr( $list['id'] ); ?>">
<label>
<input type="checkbox" class="chk-fue-list" name="fue_lists[]" value="<?php echo esc_attr( $list['id'] ); ?>" <?php checked( true, in_array( $list['id'], $subscriber_lists ) ); ?> />
<?php echo esc_html( $list['list_name'] ); ?>
</label>
</li>
<?php endforeach; ?>
</ul>
<?php wp_nonce_field( 'update_email_subscriptions', 'update-email-subscriptions-nonce' ); ?>
<input type="submit" class="button button-primary fue-button" value="<?php echo esc_attr( get_option('fue_email_subscriptions_button_text', 'Update Subscriptions') ); ?>" />
</form>
<?php
}
?>
</div>
</div>
</article>
</div><!-- #content -->
</div><!-- #primary -->
<?php
get_sidebar( 'content' );
get_sidebar();
?>
</div><!-- .wrap -->
<?php
get_footer();
Its the 2nd template that is being output.
It would take quite a bit of modification in a child theme, so that it used the theme or woo styles.
Perhaps the filter and CSS method i provided above would be a simpler option?
It would also reduce maintenance of a child theme template if the plugin author ever made an update.
So now that I’ve found some time to readdress this I found that this simple CSS is all that was needed.
At least for me.
Hope this might help someone else that uses Woocommerce Follow-Up-Emails
/* Follow-up-emails Padding */
.wrap {
padding: 50px;
}
/* End Follow-up-emails Padding */
Glad to hear that