Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Blogname] at the beginning of subject lines

  • In WordPress, in general, all notification emails are in the format ‘[blogname] subject’, but in BuddyPress Group Email Subscription emails, the ‘[blogname]‘ part is at the end of the subject lines.

    I customized my local source files to behave like WordPress — I think it help users to identify all emails that go out of my website exactly in the same manner.

    My suggestion is to make the changes in the plugin files (If you’re interested, I have the customized versions here, I just don’t know how to send it over).

    In addition to that (or as an option) you can make the subject line fully filterable. In the current version, only the text apart from ‘[blogname]‘ (action) is filterable.

    Hope this helps!

Viewing 15 replies - 1 through 15 (of 15 total)
  • Avatar of Dwenaus
    Dwenaus
    Participant

    @dwenaus

    probably best to have it filterable, because I prefer the way we have it – much more readable in my opinion.

    Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    I agree with Deryk (I think that the way WP and BP do it natively is not so hot), but a filter is definitely a nice idea. Deryk, would you like to do the honors? It’s probably a nice idea to pass the blogname and the subject as separate arguments to the filter so that people don’t have to build it from scratch.

    That’s fair enough… I agree a filter is the ideal solution — and passing blogname and subject as parameters make it even better. Thanks guys!

    Avatar of Dwenaus
    Dwenaus
    Participant

    @dwenaus

    this has been added to the most recent version. you can filter on
    ` $subject = apply_filters( ‘ass_digest_subject’, “$title [$blogname]“, $blogname, $title, $type );`
    the new version is 2.8.5

    I am trying to make this work, but I must be missing something very obvious (as I’m a total newbie in using filters). Here it is (code in `functions.php`):

    `
    function cleo_ass_digest_subject( $blogname, $title, $type ) {
    return “[$blogname] $title”;
    }
    add_filter( ‘ass_digest_subject’, ‘cleo_ass_digest_subject’, 10, 3 );
    `

    Any help is appreciated!

    Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    Off the top of my head, it looks like this code should work. The problem might be that it’s in functions.php of your theme. Try putting it in wp-content/plugins/bp-custom.php instead.

    Thanks @boonebgorges but unfortunately moving it to bp-custom.php didn’t help in this case. Any other ideas?

    Avatar of Dwenaus
    Dwenaus
    Participant

    @dwenaus

    i think it should be more like this:

    `function cleo_ass_digest_subject( $subject, $blogname, $title, $type ) {
    return “[$blogname] $title”;
    }
    add_filter( ‘ass_digest_subject’, ‘cleo_ass_digest_subject’, 10, 3 );`

    the first item passed is the actual item being filtered, which in your case you are ignoring, and just making your own and returning that. and maybe the end should be 10, 4 cause you are passing back 4 vars. but i’m not positive on that.

    Thanks for your help @dwenaus — I ran more tests, and with your help, I figured out what’s wrong:

    1. You’re right: you must pass $subject, and you must declare 4 as the number of vars.

    2. The subject filter created currently only works for digests, and not for “regular” emails.
    Hacking the code and adding `apply_filters( ‘ass_digest_subject’…` call to other points in the code (bp-activity-subscription-functions.php, line 41, 120, 243, 1059) fixes the problem. Design-wise, I’m not sure if we should use a different filter or rename the one just created (as it’s named ‘ass_digest_subject’) and pass a new parameter telling if it’s digest or regular email…

    What do you think?

    Avatar of Dwenaus
    Dwenaus
    Participant

    @dwenaus

    good that you figured it out. wp filters are tricky at first, but once you get the hang of them, they are quite powerful. i’m still learning!

    probably use another filter name for non-digest emails. offhand, something like ass_email_subject is a good name.

    Thanks @dwenaus. Since I’m going to change this in my local copy, what’s the best way to send the changes for you to integrate in the official version?

    Avatar of wpmirwin
    wpmirwin
    Participant

    @wpmirwin

    @dwenaus

    Hello Dwenaus. I was hoping you might have a little time to look at this.


    NOTE: I posted the question at the URL below first, but then realized I should probably have asked it here.

    http://buddypress.org/support/topic/registration-change-e-mail-subject-title/#post-152894

    I have a process that registers new users, sends out the welcome email, etc. These messages have a specific format for the subject. What I really need to change is the prefix of all BP email subjects to look like my other emails.

    Currently BP emails looks like:

    [Blog name] $title

    For example:

    [example.com] New message from user01

    What I would like to do is change all subject prefixes to this:

    fixed-string-1-here [fixed-string-2-here]: $title

    For example:

    Example [BuddyPress]: New message from user01

    I added the function that you and Luciano discussed above (in various ways) to my bp-custom.php, but it had no effect. Is this still the correct way to handle this, or have there been udpates to BuddyPress that change the behavour.

    I’m using BP 1.6.1 with WP 3.4.2

    Any help/advice would be really appreciated.

    Thanks!
    Mike.

    Avatar of nasive
    nasive
    Participant

    @nasive

    @wpmirwin @dwenaus

    Hi,

    Did you find any solution for this? What is the
    best way to change the subject with the last version?

    I see s2members has something to offer but it seems to
    be such a big plugin that I’m not sure that that is the
    best option. Also, I’d like to try WelcomePack but it’s
    not been updated in more than 2 years.

    Thanks

    Avatar of brucedwilliams
    brucedwilliams
    Participant

    @brucedwilliams

    I will add my voice to @lucianop for a way to make the subject conform to standard WP email subjects. It seems like this could be made a setting so that users can make the choice between prepending or appending [blogname] to the email subject line. Then everyone is happy!

    Avatar of @ubernaut
    Ben Hansen
    Participant

    @ubernaut

    @wpmirwin @dwenaus @lucianop @nasive best way to make this happen is to make a trac ticket for it if there isn’t one already.

Viewing 15 replies - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.