Firefox PHP

Calling API Returns Error (Please review my code) [SOLVED]

Posted by Notioner 
Calling API Returns Error (Please review my code) [SOLVED]
October 11, 2012 09:08PM
I use a registration system to register users - I added the following code to run after the user is register - this way it handles BOTH my site's account and their phorum account.

Doing some research, I assumed everything below would work:

Language: PHP
$cwd = getcwd(); // save current directory for later use chdir(';/var/www/html/forum';); // change directory to phorums, so the API files work define(';phorum_page';, ';register';); // define our page include("./include/api/base.php"); // now include the phorum base.php include("./include/api/user.php"); // now include the phorum user.php   $user = array( "user_id" => $model->id, // we want matching IDs "username" => $model->username, // we want matching usernames "password" => $plainTextPassword, // we want the same password "email" => $model->email, // we want the same email "admin" => 0, // no admin "active" => 1); // active is true   phorum_api_user_save($user); // now save the user with the provided array info   chdir($cwd); // change directory back to original so my code below can run its course

And I get this error:
Fatal error: Call to undefined function phorum_db_user_get() in /var/www/html/forum/include/api/user.php on line 934

I'm running a LAMP server on Fedora locally. Using updated PHP5.

Main site directory is /var/www/html
Forum Directory is: /var/www/html/forum

Can anyone offer any advice?



Edited 1 time(s). Last edit at 10/11/2012 11:19PM by Notioner.
Re: Calling API Returns Error (Please review my code)
October 11, 2012 10:11PM
The API is not (yet) self contained. You are missing the full db layer.
Easiest would be to just include common.php.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Calling API Returns Error (Please review my code)
October 11, 2012 11:18PM
Thank you Thomas, it worked.

Language: PHP
include("common.php");
Re: Calling API Returns Error (Please review my code) [SOLVED]
October 12, 2012 12:06AM
EDIT:

This fixed my login issue:
http://www.phorum.org/phorum5/read.php?28,125993,129010#msg-129010



Edited 2 time(s). Last edit at 10/12/2012 12:47AM by Notioner.
Sorry, only registered users may post in this forum.

Click here to login