0

I'm not sure if that's even possible, but I thought I should give it a try.

I'm using WP Better Emails plugin in order to create HTML emails for my buddypress website.

I want to add to the footer an option for the user to change his notification settings. Something like this: Do you want to update your notification settings? Change Settings.

I need to make 'Change Settings' a dynamic link that it'll redirect user to 'http://connect.stage.tgg.gr/members/%username%/settings/notifications/'

How can I achieve this through HTML? Can I perhaps do it through a filter?

1

I have no experience with this plugin, but it looks like you can add extra template variables with a filter named 'wpbe_tags':

    function template_vars_replacement( $template ) {
        $to_replace = array(
            'blog_url'         => get_option('siteurl'),
            'home_url'         => get_option('home'),
            'blog_name'        => get_option('blogname'),
            'blog_description' => get_option('blogdescription'),
            'admin_email'      => get_option('admin_email'),
            'date'             => date_i18n(get_option('date_format')),
            'time'             => date_i18n(get_option('time_format'))
        );
        $to_replace = apply_filters('wpbe_tags', $to_replace);

        foreach ( $to_replace as $tag => $var ) {
            $template = str_replace( '%' . $tag . '%', $var, $template );
        }

        return $template;
    }

So, this might do the trick:

add_filter( 'wpbe_tags', 'wpse_99484_extra_tpl_var' );

function wpse_99484_extra_tpl_var( $to_replace )
{
    $to_replace['username'] = function_to_get_buddy_press_user();
    return $to_replace:
}

I am not sure what the correct function_to_get_buddy_press_user() is in your situation, it depends on the context of this email.

  • Hi @toscho. I'm not very good with PHP, but I will give it a go. I want to add a link to get them to their Settings/Notifications page. I have a link 'Change Settings' that I need to connect to this URL. – kat_indo May 15 '13 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.