Then you need to explain to your boss that having users register at more than one place is a very bad idea. Things will become a huge mess. Explain him what happens when you register at the website with usernameA and at the forum with usernameB, with the same email address! Or what would happen if the user changes their password only on the website, or only on Discourse. Then things will break!
What you have done logs your SERVER into the forum as the user. It will not set the session cookies for the user, so it will not log the user into the forum.
Additionally, you apparently have the plain text password for the user to your disposal. This is a VERY BAD idea. You should always store a hash (one-way encryption) of a password, and never the plain text password. When your database gets hacked, all the passwords of your users will be known to the attacker. Another good thing to explain to your boss.
I have given you three good reasons that you can use to convince your boss to do things differently. This will only lead to huge problems. I cannot help you with getting this to work, because it will not work. Even if you get it to work it will only work in the short run.