Welcome PM is sometimes sent twice


#1

I’ve been noticing this a fair bit lately:

It doesn’t happen every time, but it’s not uncommon. It’s also not new – I first noticed it many months ago. I have customised the text content via the AdminCP but have done nothing else that I’m aware of that could cause this.

Do other people have this issue? It’s not a great first impression.

What further info is required in order to investigate?


(David Collantes) #2

Not related to your issue, but feverbee board is having other issues too. There seems to be mixed SSL/non content, clicking on users icons render a blank page… something is not right there.


(Simon Cossar) #3

I just signed up and received the two Welcome to FeverBee emails. What are you using for SSO between your website and your forum?


#4

Thanks for the feedback, but I’m not quite sure what you mean here. Can you give me specifics? User icons?

PrimeTime WP Discourse SSO


(David Collantes) #5

<img src="//discourse-meta.s3-us-west-1.amazonaws.com/original/3X/7/5/7511f50681dc91d7501a5657e35dd96a143f6c4f.gif" width=“589” height="500”>

This is what I meant.


#6

Huh. Only seems to be the case when logged out.


(Sam Saffron) #7

This is a side effect of “hide user profiles from public” @eviltrout is adding it to his list, the double pm thing is strange, we will also investigate


#8

All good. Thanks, as always.


(Simon Cossar) #9

I was surprised to be automatically logged into the forum when I created an account on the WordPress site. It seems that on registration a new user is being created on the forum through the API. This will cause Discourse to send the welcome message. It seems that immediately after this, the user is automatically logged into the forum with their SSO credentials. This shouldn’t cause a welcome message to be sent, as the user is active, but possibly something is going wrong here.

I don’t know if it’s a concern, but user emails on your forum are not being validated.


#10

Correct.

It’s only sporadic. And even stranger, neither of your new accounts appear to have received two, although you mentioned above that you did.

It was a conscious decision to streamline the registration process. Decided to give it a try for a while and see whether it caused issues. It hasn’t in almost a year, so not stressed.


(Simon Cossar) #11

Yes, both attempts at doing that were sent two welcome emails. If you want to simplify the login process to Discourse, you could just change the Community link in the header to an SSO link for logged in users. This way, you don’t need to create a user through the API. I’m doing it like this, but it will depend on how your menu is created.

function discourse_community_link( $items, $args ) {
    if ( 'primary' === $args->theme_location ) {
        if ( is_user_logged_in() ) {
            $community_link = '<li><a href="http://localhost:3000/session/sso?return_path=/">Community</a> </li>';
        } else {
            $community_link = '<li><a href="http://localhost:3000">Community</a> </li>';
        }
        $items = $items . $community_link;
    }

    return $items;
}
add_filter( 'wp_nav_menu_items', 'discourse_community_link', 10, 2 );

#12

So this is yet another issue then – it was initially the two welcome PMs that I was concerned about. Ugh.

I’m not sure I quite get what you mean. For logged in users, or for not-yet-registered users?
If you mean logged in, then doesn’t the user already exist?


#13

Further to that – would you mind posting an image of the email that you received two of?
That issue almost certainly isn’t Discourse related – I think Paid Memberships Pro is sending it from the WP side.


(Simon Cossar) #14

This is the email I was sent twice when I registered:

What that code does is create a link that will log a user into your forum if they are logged into your website. If the user doesn’t yet exist on the forum it will create a new user. That way you don’t need to create a user through the API during the registration process. The way your website’s registration process is set up, users are logged into the website when they register, so after registration, if they click on the Community link, it will create an account for them on the forum and log them in.

For user’s who aren’t logged into the website, it will generate a normal link to your homepage.


(Robin Ward) #15

This fixes the weird bug of anonymous users clicking on cards when public profiles are disabled: