Simple Machines Community Forum

Customizing SMF => Bridges and Integrations => Topic started by: CoderLanie on April 08, 2021, 08:32:32 PM

Title: How do I log into SMF from my application?
Post by: CoderLanie on April 08, 2021, 08:32:32 PM
I saw a lot of posts in late 2019 addressing this but I also saw that a lot of updates were going to fix it. I'm still having issues with this. I use these programs on Site Ground. Can someone help?

I am trying to integrate my website and the forum. I want to do all the login/logout/registration from my website. Can I still do this with these deprecations or are they critical?
Title: Re: PHP 7.3 + SMF 2.08 = Deprecated create_function()
Post by: SpacePhoenix on April 09, 2021, 05:14:15 AM
You might want to consider upgrading to a newer version of SMF as you're just a few versions behind (2.0.18 is the current version of the 2.0.x branch). I can't remember off-hand if you can upgrade straight to 2.0.18 or if you have to upgrade to each version in turn until you get to 2.0.18
Title: Re: PHP 7.3 + SMF 2.08 = Deprecated create_function()
Post by: vbgamer45 on April 09, 2021, 09:00:29 AM
Yes 2.0.18 works great with PHP 7.3+
Title: Re: PHP 7.3 + SMF 2.0.18 = Deprecated create_function() [corrected title]
Post by: CoderLanie on April 09, 2021, 12:16:03 PM
Oops! I just double checked. SMF is using the 2.0.18 version.

I used the API from this link:
https://simplemachines.org/community/index.php?topic=453008.0
Title: Re: PHP 7.3 + SMF 2.08 = Deprecated create_function()
Post by: vbgamer45 on April 09, 2021, 12:25:05 PM
That API probably is not updated.
Title: Re: PHP 7.3 + SMF 2.08 = Deprecated create_function()
Post by: CoderLanie on April 09, 2021, 12:32:27 PM
Where can I get the latest?

I thought SiteGround automatically updated the PHP but I manually set it to php 7.4 so now I have to get the updated API.
Title: Re: PHP 7.3 + SMF 2.08 = Deprecated create_function()
Post by: Kindred on April 09, 2021, 07:48:57 PM
That api has not been updated in years....
Title: Re: PHP 7.3 + SMF 2.08 = Deprecated create_function()
Post by: CoderLanie on April 10, 2021, 02:37:23 PM
Two people in this thread has said the API has not been updated and neither person pointed to where the updated one is, nor directed me on how to solve my problem.
Title: How do I log into SMF from my application?
Post by: CoderLanie on April 10, 2021, 02:48:23 PM
Can someone point me to the files and guide on how to log into SMF from my third party application?

I have tried the API files from 2011 to no avail and no one has given me links or resources on to an updated one so I will ask directly:

how do I do the above?
Title: Re: PHP 7.3 + SMF 2.08 = Deprecated create_function()
Post by: Illori on April 10, 2021, 04:46:52 PM
we dont have a more updated version of the API beyond what is in that topic.
Title: Re: PHP 7.3 + SMF 2.08 = Deprecated create_function()
Post by: CoderLanie on April 10, 2021, 05:01:28 PM
Okay, that's unfortunate. I made a separate thread but how do I login into SMF from my application without an updated API? Are these functions available in the updated versions without having to add files?
Title: Re: Login/Logout/Register from Third party application
Post by: shadav on April 10, 2021, 07:31:18 PM
that would probably depend on what applications

did you looked into the Bridges and Integrations (https://www.simplemachines.org/community/index.php?board=33.0) board?

or posting into the Help Wanted (not for support) (https://www.simplemachines.org/community/index.php?board=50.0) board if it is something that you need custom made
Title: Re: Login/Logout/Register from Third party application
Post by: CoderLanie on April 10, 2021, 07:41:03 PM
That first board has the 2011 file which I was told was outdated by two people.

And I would like to learn how to code this myself.

I just need to a tutorial or something.

I am honestly confused (and frustrated) why i'm not getting direct answers.
Title: How do I log into SMF from my application?
Post by: CoderLanie on April 10, 2021, 07:42:37 PM
This is the third thread in which I am simply asking:

how do I register/login/logout from my third party application?

The file from 2011 is outdated.

Where is the newest file?
Title: Re: How do I log into SMF from my application?
Post by: shadav on April 10, 2021, 08:08:01 PM
you do realise by creating all of these different topics, you are actually making it more difficult for anyone to answer you....and well you'd more than likely get the same answers that were already posted in your other threads....

(and on that note, I'm going to merge all 3 together so that you do not get repeat answers)

that being said, again that would probably depend on what applications....and since you already said you are wanting to learn how to do it yourself, then we would really need to know what applications so that others could point you into the right directions
Title: Re: Login/Logout/Register from Third party application
Post by: Ninja ZX-10RR on April 10, 2021, 08:12:11 PM
Posting 3 times the same thing is only going to annoy whoever reads them, historically speaking. People here devote their free time to answer you, if you post 3 times impatiently it drastically reduces any willingness to reply :)
That said, you don't just "hurr durr login", you update the software entirely in order to work with the new functions. It's like a puzzle, you can't simply throw pieces from another puzzle in and expect it to work. Update to 2.0.18 via
Large Upgrade (https://wiki.simplemachines.org/smf/Upgrading) (removing mods in the process) or by Patching (https://wiki.simplemachines.org/smf/Patching) (keep mods but have to install each version progressively.

EDIT: partially ninja'd, as you can see.
Title: Re: How do I log into SMF from my application?
Post by: CoderLanie on April 10, 2021, 08:16:11 PM
Posting once and getting vague answers such as "that code is outdated" with no one pointing directions is equally as annoying.

If I need to updated software entirely, I need directions on what information I need.
If the API from 2011 is outdated, then what are people using?
If SMF has been updated where the functions are available, what information do I need to pass through?

If I have to update my entire application, I need to know the info
Title: Re: How do I log into SMF from my application?
Post by: shadav on April 10, 2021, 08:27:25 PM
fairly sure most folks just use the ssi functions

https://wiki.simplemachines.org/smf/Category:Integrating_SMF
https://wiki.simplemachines.org/smf/Category:SSI
Title: Re: How do I log into SMF from my application?
Post by: CoderLanie on April 10, 2021, 08:44:43 PM
Thank you.
Title: Re: How do I log into SMF from my application?
Post by: Kindred on April 10, 2021, 10:11:03 PM
To be clear... the answers weren't vague.

You asked "why does this not work?"
You were told "the API is not designed to work with newer versions of php"
You asked "where is the updated api?"
You were told "there is no update available."

How is that in the least bit vague??
It might not be what you wanted to hear, but it is definitely not vague.

Title: Re: How do I log into SMF from my application?
Post by: CoderLanie on April 10, 2021, 10:25:23 PM
If someone asks, "Is 1111 Ave Street where the library is?" would you answer, "No" or would you answer, "No, it's at 2123 Boulevard"?

Saying "no" is technically helpful, but how does that help the person searching for the library? All it does it makes them have to search for a new address instead of heading towards the direction. Even a "No, but it's on that boulevard somewhere" would have been more helpful than just simply telling me a file is outdated.

I did not ask "why doesn't this work?" I already know. It's deprecated functions. I asked if I could still use the file without it and update it as necessary.
Simply telling me it's outdated and simply telling me there are no updates doesn't help me solve any problems.

The answers are vague in a way that they don't tell me which direction to go.

My apologies if "vague" is used incorrectly but it took way too much effort to be pointed in a reliable direction.
Title: Re: How do I log into SMF from my application?
Post by: Kindred on April 11, 2021, 12:01:42 AM
Except, if we follow your analogy in this case, the answer was "no. The library closed and they did not open another one"
(Which was the full and complete answer)

Just because you did not like that answer, does not change anything.
you kept asking the same question in the hopes of getting a different answer, but kept getting the same answer - because the answer was full and accurate,  as much as could be, given the facts.


Title: Re: How do I log into SMF from my application?
Post by: CoderLanie on April 11, 2021, 01:23:16 AM
Fair enough, but I would also answer as "No, the library closed.. but there's a book store at.." Maybe I just answer things different.. I dunno, but I'll consider this experience a lesson learned.
Title: Re: How do I log into SMF from my application?
Post by: m4z on April 11, 2021, 02:43:57 PM
The replies weren't vague, but missing context that somebody new to SMF wouldn't know: The API was a contribution by somebody outside of the SMF team, so "the API wasn't updated" means "this is the most recent version there is; nothing more recent exists, and if that person (or another volunteer) doesn't update it, you're out of luck". Also, since it is not part of the software and so outdated, probably nobody knows the code.

You said from the start you had problems with it, but didn't explain specifics, so probably nobody here was motivated enough to try it out for themselves. (If you don't invest the effort to even explain, in detail, where or what your problems are, why would I read that other thread, build a test forum and try to get the API to work myself? If I ran into problems, I wouldn't even know if those are the same problems that you're having.)
Title: Re: How do I log into SMF from my application?
Post by: CoderLanie on April 12, 2021, 12:47:41 AM
Alright. Let me reask the question with a more open mind and a little bit more experience.

How do I set the credentials for the forum using my own custom website login?

I looked at the ssi_login() feature. That allows the forums login into be on my website but not what I'm looking for. I want to submit my information (userid/email, password) and then pass it through SMF's login stuff and get them logged in.

I am okay setting the credentials (which from my naive understanding: that means setting the cookies for the forum) from my login, but not sure exactly what they are.

I was considering having my login form -> on submit, would go to form page -> the ssi_login() would be altered so it's auto filled out by the information submitted -> javascript to submit it automatically. As someone who is new (and struggles with javascript), do you think this is reasonable?

I am not looking for someone to make the code, I just need the logic behind it.
Title: Re: How do I log into SMF from my application?
Post by: Kindred on April 12, 2021, 08:41:24 AM
cache:

if you want to use SMF's permissions system and login, you can use ssi_login with a target page on completion, instead of the default of the boardindex

function ssi_login($redirect_to = '', $output_method = 'echo')

CoderLanie:
As noted, there is no currently functional API between external pages to pass the login info through to SMF.   The API and bridges previously designed will not work on current php versions.
That being said, I *THINK* someone made a WordPress bridge with SMF which *MIGHT* be a place to start looking...    but IIRC, that bridge goes the other way (using SMF's login in WordPress, not the WordPress login passed to SMF)



And no. You do NOT want a javascript like that...   that's a potentially HUGE security hole.
You would want to pass through the login info directly in database/php -- probably using the Hooks system, since, IIRC, there IS a pass-through hook somewhere in the login process... I just don't remember where it is or what parameters it takes.

Title: Re: How do I log into SMF from my application?
Post by: Ninja ZX-10RR on April 12, 2021, 09:20:27 AM
There's both bridges in fact, but that's a good idea, so I'll expand upon that and link you to the "reversed" bridge: https://github.com/xchwarze/WP2SMFBridge
And yes it should work with current versions.
Title: Re: How do I log into SMF from my application?
Post by: CoderLanie on April 12, 2021, 01:47:33 PM
Unfortunately, I coded my website from scratch and didn't use any Word Press or anything like that so the github link won't help me out.


Alright, I really don't want to code my entire forum so I will have to use the SMF login. I am okay with this; but where in the file do I set the credentials? I don't want to set my cookies all willy nilly anywhere.


Wait.. this also means I have to adjust the registration and everything.. ugh..
Title: Re: How do I log into SMF from my application?
Post by: Kindred on April 12, 2021, 04:17:28 PM
coderlanie...


no, you missed my point.    LOOK at how it was done in the WP bridge, then use THAT as a baseline for how it COULD BE done for your site with some tweaks.

However... as I also said... there are HOOKS for registration and login which allow the hook of additional functions (to run additional actions IN the SMF functions...like cookie setting...    or possibly to accept a un/pw combination...)
Title: Re: How do I log into SMF from my application?
Post by: live627 on April 12, 2021, 09:53:44 PM
here is some documentation

https://wiki.simplemachines.org/smf/Integration_hooks