Customizing SMF > Portals, Bridges, and Integrations

smf_authenticateUser() always returns false

(1/1)

murraywsmith@telus.net:
I'm trying to use smf_1-1_api.php with SMF 2.0.2 and smf_authenticateUser() always returns false. Is that api file compatible with SMF 2.0.2?

My code is the following:

<?php
   include '../../smf_1-1_api.php';
                header('Content-type: text/xml');
                echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
                echo "<response>\n";
   if( smf_authenticateUser() )
   {
      echo "\t<authenticated>true</authenticated>\n";
   }
   else
   {
      echo "\t<authenticated>false</authenticated>\n";
   }
   
   echo "\t<forumName>";
   echo $smf_settings['forum_name'];
   echo "</forumName>\n";
   
   echo "</response>\n";
?>

Arantor:
Why are you using the 1.1.x API with 2.0? Use the 2.0 API!

murraywsmith@telus.net:
I think my question can be ignored. I landed on a download page that only contained the 1.0 and 1.1 api files so I didn't realize there were version 2.0 api files. I found them now at http://www.simplemachines.org/community/index.php?topic=453008.0

From my application I'm trying to check and see if the user is logged in and if they are I need to know thier user id. Looking at the information at the link above it looks like I need to use the integration hooks and do some thing like the following:
- implement the login hook and set a cookie with the user's id.
- then in my code I can check for the cookie and if it exists the user is logged in and I can get the user id from the cookie.
- implement the logout hook to delete the cookie.

Well anyway, I'll give that a try and see if it works.

Navigation

[0] Message Index

Go to full version