News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

New tools to help integrating SMF with something else

Started by Andre N, September 19, 2011, 01:35:36 PM

Previous topic - Next topic

nathanmc

Hi Andre,

And now there is another issue....

I can no longer use the quick login to the forum. It says incorrect password. Then on the subsequent screen I reenter the password and it logs in. But, when I click on Members (for example) it thinks I'm not logged in.

Can you please assist...

Thak you.
Yours Sincerely,

Nathan McNamara
Inventerest
www.inventerest.com

nathanmc

Hi there,

I've fixed the registration issue, my fault, I had the code in the wrong spot of the main registration process.

However, I still have the above SMF login problem. Not related to my own system setup, this is just trying to log directly into SMF.

Any assistance would be wonderful.
Yours Sincerely,

Nathan McNamara
Inventerest
www.inventerest.com

nathanmc

I've now fixed the login problem, thanks to "miikka_" via post:
http://www.simplemachines.org/community/index.php?topic=363778.msg2551833#msg2551833

Basically, the www was missing from the Settings.php file $boardurl

This fixed the problem!!

Hope this helps others and I do wonder why this occurred?
Yours Sincerely,

Nathan McNamara
Inventerest
www.inventerest.com

nathanmc

Hi everyone,

I've finally been able to integrate Registration, Logging In and Logging out with my website via the API.

Unfortunately (it seems) SMF doesn't automatically remove the Login Logout and Register buttons when registration functionality is disabled and "Show a quick login on every page" is off.

Therefore, after reading hundreds of topics/posts, I found that you can at least redirect the login by placing a redirect at the top of the file "LogInOut.php" and "Register.php" (found in the Sources folder).

However, I'm still trying to remove the LOGOUT button from the menu.

Can someone please help me with this?

Thank you.
Yours Sincerely,

Nathan McNamara
Inventerest
www.inventerest.com

Kindred

???
if registration is disabled, then yes... SMF removes (does nto display) the register button.
However, of course it continues to show the login or logout button....  Those are not part of registration.

to remove those, you would delete or comment out the button listing from the menu array in subs.php
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

nathanmc

Hi Kindred,

Thank you for your reply.

However, the Register button is still shown in the menu, even when Registration is disabled. This I believe, is an oversight that should perhaps be rectified in a future release.

Additionally, I've found instruction on other posts regarding deleting out the menu array for Login, Logout, Register in the Subs.php file. However, even if this has been done, this is ignored. And all of these options are still shown.

Something that people should be aware of, even if you perform the above action, the cache will hold onto these options (via cache? or cookies? or?) and you won't see the effect. Only today, after a PC restart do I see the removed buttons.

Thank you.

Yours Sincerely,

Nathan McNamara
Inventerest
www.inventerest.com

Kindred

Nathan,

1... In my unmodified forum, register does not show if disabled.
2... Deleting the login, logout and register buttons from the menu array in subs.php removes the buttons. No other files Ned to be modified, but you could comment out the logout and login actions in index.php if you want to be thorough.


So, if these actions do not work for you, then you have other issues with our installation. Possibly a theme which does not respect the menu array.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),


Either you're imagining it or it's not a fresh install: the register button STILL SHOWS even if registration is disabled.

On top of that there's still several language strings that needed to be changed to fix this (as I had to do in Wedge a bit back for this very reason)

The cache will only be held in the event of cache level being 2 or higher, as per:
if (!empty($modSettings['cache_enable']) && $modSettings['cache_enable'] >= 2)
cache_put_data('menu_buttons-' . implode('_', $user_info['groups']) . '-' . $user_info['language'], $menu_buttons, $cacheTime);


SMF does not install to level 2 on default. So other things could also be at play.

nathanmc

Hi Arantor.

I'm not imagining it. The SMF is a fresh install, I'm still setting it up and modifying minor elements of the default theme (copied to another name). 

The cache level is the default install, so that won't be an issue as I never modified (I double checked).

It is doing the same thing with other file modifications as well. E.g. I'm attempting to modify the Script.js (as directed by Oldiesmann on another post) to set the default for all of the boards to be collapsed.

Perhaps it's a server issue with the cache? I refresh using Ctrl F5 in Firefox, so I don't believe it's a browser issue....

Any suggestions?

Thanks
Yours Sincerely,

Nathan McNamara
Inventerest
www.inventerest.com

Kindred

I think the imagination comment was directed at me...  And he's apparently correct. For some reason, the logic seems to ave gotten lost.

However, removing the registration men item, same as logout and login will still work.

If editing the menu array in subs.php is not shoeing, then either your sever cache is not refreshed or your theme is not using the enu array.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

keyrocks

I am fairly new to SMF 2.0.2 and have just completed configuring it with 320 Member-Groups and corresponding Forum Boards for each Member-Group. All of my work to-date has been accomplished offline on my localhost (home office) XP-Pro server running with XAMPP.

The next step:
To integrate this package with a client's WordPress + BuddyPress powered website already online at (ficticious domain) mainsite.com. The client wants the SMF package installed at mainsite.com/smf (located in a new smf directory within the site's root).

The Client's system:
When someone registers for an account at mainsite.com, the registration form collects the registrant's name, email, postal code, and a password. Once submitted, scratch-built functions (compatible with and in the WordPress site at mainsite.com) query an external d-base which contains the organization's master membership data.

A query checks the external d-base for a name and email match. If the match is positive (they exist), another query pulls the registrant's Member ID and Regional ID from the external d-base and adds them to his/her user profile for mainsite.com when the user's account is created and activated.

The Mission:
I do not have access to the client's servers or databases (their security policy), and the client's IT guy doesn't have time to figure out how to integrate the SMF package so that it is compatible with their WP + BuddyPress package already running on mainsite.com. The SMF package also needs to pull member information from their external d-base.

When a member logs into mainsite.com, they need to be automatically logged in to the SMF site at mainsite.com/SMF at the same time. Once logged in, the link to the SMF Forums will be added to the main menu-bar at mainsite.com. Clicking the "Forums" link in the main menu bar will land them on the main SMF Forum Boards page.

The SMF package will also need to pull the member's Regional ID from the client's external d-base and use that to:
1) automatically set the member's Member-Group already created (named identical to the Regional ID)
2) assign the same-named (Regional ID) Forum Board to be visible to the member when they are on the main Forums page.

Question:
Am I right to assume that I would need to use the API to accomplish all of that?
And, if so, what would be involved in getting there (broadly speaking of course).  8)

nathanmc

Hi there,

I've utilised the API to integrate the forum with my website. All seems to function ok now.

Except, the user logs into my site, which logs the user into the forum ok using the API. The forum menu shows just fine, as does the forum.

However, there seems to be a session issue going on, because when the user clicks on one of the forum menu items, it doesn't recognise that they are logged in and throws an error.

If one of the legends of the SMF community could take a look I'd be very grateful :)
If there is any code snippets you'd like, please let me know.

The link to the site is: www.inventerest.com [nofollow]

Thanks very much.


ADDENDUM: The issue I recalled was that the link to the website must be full and complete. During the installation by Installatron (VIA Control Panel) the settings.php doesn't get allocated the full website address. In this case it contained "http://inventerest.com/forum [nofollow]" instead of the correct "http://www.inventerest.com/forum [nofollow]"
Perhaps this should be addressed as an issue to be fixed??
Yours Sincerely,

Nathan McNamara
Inventerest
www.inventerest.com

Kindred

it's not an issue on our side, since we don't control any automated installation scripts called Installatron... That sounds like a problem with how you host has configured the installation script that they set up.

Of course, many people are using the (no-www) address these days anyway, but if you turn ON subdomaind independent cookies, it should also fix the problem.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

nathanmc

Hi Kindred,

Good point about it not being your issue and Installatron.

And thanks for the heads up about the subdomain independent cookies.

Much appreciated!!
Yours Sincerely,

Nathan McNamara
Inventerest
www.inventerest.com

Rajohan

How can i check if the user is logged in? I got a login to work perfectly, but i cant quite figure out how to check if the user i online. WHat i got now is


if(!smfapi_isOnline($user_info[username])) {
// show login
}
else {
//show user menu
}


it works but it seams like the username still is stored in smfapi_loadUserSettings(); when i try echo it out after ive logged out i still returns my username but the login shows and user menu gets hidden.

LillyWhite

#115
Hi! I've been trying to integrate a website with smf (using the same account of smf) but i need some help. This does work fine if i login on the forum for the first time (This is on the website):

      require_once($_SERVER['DOCUMENT_ROOT'] . '/forum/smf_2_api.php');
         
      global $user_info;
      $username = $user_info['username'];

      if ($user_info['is_guest']) {
         $data['header'] = "header";
      } else {
         $data['header'] = "headerlogged";
      }

If i close the web browser, when i visit my website i remain logged on the forum but it loads the guest "header" on the website. If i want this code to work again, I have to logout from the forum and login again. How can i check on my site if im already logged on the forum so i can display the "headerlogged" if i'm logged?

Thank you.


Arantor

You have to do more than simply load the API file.

You can either change the require to reference /forum/SSI.php which will make your code work as expected, or you can add more code to make it work.

LillyWhite

Hi. Ty for the quick help. If i change the require to SSI.php it works in the same way it did before. When i close the web browser it stops working. Checking the cookies, i see that they are not set when i visit the site without login first on the forum. This only works if i login first on the forum. Any idea what i must do to check if i am already logged on the forum by just visiting my site? I'm using codeigniter framework and im trying to use the same account of the forum in the site. Thank you. 

Arantor

Well, SSI should be set first, and you probably have to also set subdomain independent cookies in Admin > Configuration > Server Settings > Cookies and Sessions.

Any other sessions will not play nicely with SMF's.

Advertisement: