Simple Machines Community Forum

General Community => Scripting Help => Topic started by: RL on May 07, 2018, 05:36:41 AM

Title: Trying to display SMF Welcome or Login on a Wordpress frontend
Post by: RL on May 07, 2018, 05:36:41 AM
Hi guys

So this is the setup I have:
Wordpress site: site.com
SMF forum: site.com/forum

Just trying to get a "Hello <username>" to display on the Wordpress site's homepage with username being filled in from the SMF forum. Not looking to integrate logins or databases here, just want to display the text plainly.

Using SSI.php on a plain PHP file, eg: site.com/test.php I am able to get the welcome message correctly (if I am logged in on the forum, it shows the username, if not shows the login link) but when I put the same code to the Wordpress site it always shows me as a guest. I have tried everything available to no avail. What am I doing wrong.

Appreciate the help.
Title: Re: Trying to display SMF Welcome or Login on a Wordpress frontend
Post by: Aleksi "Lex" Kilpinen on May 07, 2018, 06:12:47 AM
What is the code you are using right now exactly? I know WP and SMF don't always like to play nice together, but I'd think what you are trying to do should be fairly easy to achieve.
Title: Re: Trying to display SMF Welcome or Login on a Wordpress frontend
Post by: RL on May 07, 2018, 06:55:54 AM
What is the code you are using right now exactly? I know WP and SMF don't always like to play nice together, but I'd think what you are trying to do should be fairly easy to achieve.

Thank you for the reply. Using the same code on both the Wordpress page and the PHP page test.php:

require("/var/www/html/site/forum/SSI.php");
ssi_welcome();

On the Wordpress page it only shows up as a guest regardless of being logged in on the SMF forum, on the test.php it shows up correctly.
Title: Re: Trying to display SMF Welcome or Login on a Wordpress frontend
Post by: Illori on May 07, 2018, 07:44:21 AM
are you running the test.php file from the same location as the wordpress install?
Title: Re: Trying to display SMF Welcome or Login on a Wordpress frontend
Post by: Kindred on May 07, 2018, 10:35:32 AM
you are going to have issues....   there are known collisions between SMF and wordpress variable names.


however, in SMF
turn ON subdomain independent cookies
turn OFF local cookies
Title: Re: Trying to display SMF Welcome or Login on a Wordpress frontend
Post by: GigaWatt on May 07, 2018, 05:31:14 PM
But then he has to change the address of the forum, right? From site.com/forum to forum.site.com ???.
Title: Re: Trying to display SMF Welcome or Login on a Wordpress frontend
Post by: Illori on May 07, 2018, 05:49:11 PM
nope. it should work either way.
Title: Re: Trying to display SMF Welcome or Login on a Wordpress frontend
Post by: GigaWatt on May 07, 2018, 05:58:29 PM
Mhm, got it... it's a general setting for the script. It works regardless of what's the address of the forum, right?
Title: Re: Trying to display SMF Welcome or Login on a Wordpress frontend
Post by: Illori on May 08, 2018, 05:06:29 AM
as long as it is on your domain.