Firefox PHP

Use of existing member system [solved]

Posted by Terradon 
Re: Use of existing member system
October 19, 2010 11:05PM
phorum5 requires php5! You won't be happy running it on php4 at all.


Thomas Seifert
Phorum Development Team / Mysnip-Solutions.de
Custom Phorum and general software development
worry-free Phorum Hosting
Re: Use of existing member system
October 20, 2010 07:20PM
Installed it on a php5 server now, perfectly now.

So my challenge can goes further now:)

I can choose which external authentication i want.
because i have not written a plugin for my application (no clue where to begin yet)
i have chosen base/example for now.

So for now, i have to find out how to go on further...
Re: Use of existing member system
October 20, 2010 07:37PM
You can start with the Plugin Development Guide for the External Authentication module. You can also use the other plugins as examples.


Joe Curia (aka Azumandias)
Modules: l0Admin Mass Email00000000l000000Automatic Time Zones000ll.l00000Enhanced Custom Profiles0.00Google Calendar0000l.l000000Post Previews
000000000Admin Security Suite000000000000Check Modules for Upgrades0000External Authentication000000Group Auto-Email00000.00000Private Message Alerts
000000000Attachment Download Counter0000Custom Attachment Icons000ll.ll00Favorite Forums000000.00000Highlighted Search Terms0000Self-Delete Posts Option
000000000Attachment Watermarks0l00000000Custom Language Database00l.l.0Forum Lockdown00000.00000Ignore Forums0000000000000Threaded Tree View
000000000Automatic Message Pruning00.llll.00Easy Color Scheme Manager0l.l00Forum Subscriptions0000lll000Moderated User Group
Templates:lGeneric Integration000000000 0000Simple Rounded000000 00000000Tabbed Emerald
Re: Use of existing member system
October 20, 2010 10:18PM
Piece by piece.....

I have edited info.php

In Edit settings for the External Authentication module
I can choose: comm_external_auth_plugin

when i save this setting, i get:

Warning: scandir(./mods/external_authentication/plugins_bin/common_external_auth_plugin) [function.scandir]: failed to open dir: No such file or directory in /home/XXX/domains/XXX.nl/public_html/phorum/mods/external_authentication/settings.php on line 45

Warning: scandir() [function.scandir]: (errno 2): No such file or directory in /home/XXX/domains/XXX.nl/public_html/phorum/mods/external_authentication/settings.php on line 45



Warning: Invalid argument supplied for foreach() in /home/XXX/domains/XXX.nl/public_html/phorum/mods/external_authentication/settings.php on line 46

It does not make any difference, if i fill in the path to my application or not??

What am i doing wrong here?

THIS PROBLEM SOLVED, (MISTYPE IN INFO.PHP)



Edited 1 time(s). Last edit at 10/20/2010 10:31PM by Terradon.
Re: Use of existing member system
October 20, 2010 10:58PM
it really drives me crazy:)

next piece:
earlier i was able to chose my plugin, but now.......
when i click on settings i get the next errors:


Warning: include_once(./include/api/base.php) [function.include-once]: failed to open stream: No such file or directory in /home/xxxx/domains/xxxx.nl/public_html/phorum/mods/external_authentication/plugins_bin/comm_external_auth_plugin/settings.php on line 38

Warning: include_once() [function.include]: Failed opening './include/api/base.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/xxxx/domains//xxxx.nl/public_html/phorum/mods/external_authentication/plugins_bin/comm_external_auth_plugin/settings.php on line 38

Warning: include_once(./include/api/custom_profile_fields.php) [function.include-once]: failed to open stream: No such file or directory in /home//xxxx/domains//xxxx.nl/public_html/phorum/mods/external_authentication/plugins_bin/comm_external_auth_plugin/settings.php on line 39

Warning: include_once() [function.include]: Failed opening './include/api/custom_profile_fields.php' for inclusion (include_path='.:/usr/local/lib/php') in /home//xxxx/domains//xxxx.nl/public_html/phorum/mods/external_authentication/plugins_bin/comm_external_auth_plugin/settings.php on line 39

Fatal error: Call to undefined function phorum_api_custom_profile_field_configure() in /home//xxxx/domains//xxxx.nl/public_html/phorum/mods/external_authentication/plugins_bin/comm_external_auth_plugin/settings.php on line 41


Line 37: // gather application data if an external application has been chosen
Line 38: if (!empty($PHORUM["phorum_mod_external_authentication"]["mod_app_folder"])) {

As far as I understand this: it seems this var holds the directory of my plugin,
which should be: comm_external_auth_plugin


And now?

[edit]
took the wrong settings.php
its about this code:

// if the field does not exist yet
if (!isset($YOUR_PROFILE_FIELD_status)) {
// pull in the necessary api code
include_once("./include/api/base.php");
include_once("./include/api/custom_profile_fields.php");
// and create the field
phorum_api_custom_profile_field_configure(array (


[/edit]



Edited 3 time(s). Last edit at 10/20/2010 11:07PM by Terradon.
Re: Use of existing member system
October 21, 2010 01:07AM
Deleted everything, including tables.
New install.
Did not change anything inside the script => no errors now.

created directory: comm_external_auth_plugin
created info.php

in settings i disabled all 4 options, but still i see the login links/forms?

Status: desperade



Edited 1 time(s). Last edit at 10/21/2010 01:08AM by Terradon.
Re: Use of existing member system
October 21, 2010 01:09AM
Did you do a chdir() to a different directory than the Phorum directory? The file include/api/base.php is a standard file in the Phorum distribution, so it should be available for sure.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Use of existing member system
October 21, 2010 01:18AM
Hi maurice,
i just started all over again, without copying the base plugin,
just created a new directory and the info.php file.
So far so good.
i also created a link from my mainpage to forum5/
of course i am not logged in then (due to a lack of any code for this), but i expected not to see a login link/form, because i have disabled this in settings?

<hr />
usually manuals are written by experts,
so.....that's the reason why i do not understand the manuals)
Re: Use of existing member system
October 21, 2010 11:44AM
I am trying to write hook_user_session_restore.php and, as expected, i ran into a few questions, which i have written between ### in my code.


if (!defined("PHORUM")) return; // DO NOT REMOVE THIS!!

// If you need to run php code located in the external application's server path
// you can use the following code as an example

### WHAT KIND OF CODE SHOULD I RUN HERE?? ###

// no need to continue if the external app path is not set.

### IF NOT SET, NO EXTERNAL AUTHENTICATION POSSIBLE?? ###

if (empty($PHORUM["phorum_mod_external_authentication"]["app_path"])) return $session_data;

// save the working directory and move to the external application's directory
$curcwd = getcwd(); ### GET WORKING DIR, WHY ?? ###

chdir($PHORUM["phorum_mod_external_authentication"]["app_path"]);

### WHAT IS THE USE OF THIS?? ###

// include the necessary code from your external application

### NO SUCH EXAMPLE FILE IN DISTRIBUTION PACK ?? ###
### WHICH NECESSARY CODE ?? ###

//include_once("./example_user_api.php");

// get the session for the external application

### THE MAGIC CONNECTION BETWEEN OWN WEBAPPLICATION AND PHORUM?? ###
### SO NEED TO SET A COOKIE IN OWN WEBAPPLICATION?? ###
### HOW ?? ###

$session = (!empty($_COOKIE["external_app_session"])) ? $_COOKIE["external_app_session"] : $_SESSION["external_app_session"];


// get the user info from the external application

### WHERE CAN I FIND THIS FUNCTION?? ###

$user_data = example_get_user_funtction($session); // ???

I have been busy for 4 days now, so any comment is really appreciated by me!

By the way:
"The file include/api/base.php is a standard file in the Phorum distribution, so it should be available for sure."
There is no include/api/ directory in my downloaded phorum script!
[edit]I had downloaded 5.1.25 ?? Downloaded newest version now (5.2.16RC1) [/edit]



Edited 2 time(s). Last edit at 10/21/2010 12:12PM by Terradon.
Re: Use of existing member system
October 21, 2010 01:26PM
if (!defined("PHORUM")) return; // DO NOT REMOVE THIS!!

### GET WORKING DIR so later on, we can return to the Phorum dir. That
### is needed because Phorum 5.2 includes all its files relative to the
### installation directory. If you change the working directory, then
### Phorum won't be able to find its files.

$curcwd = getcwd();

### When needed (and only when needed for the main application), change
### to the directory of that application. Often a relative chdir is most practical
### here (e.g. "../mainapp", when the mainapp folder is next to the phorum
### folder).

chdir("path/to/main/application");

### Here you would include code that the main application needs.
### We cannot tell you what this code is. It differs per application.
### But it is for sure a library of that other application, not of Phorum.
### This library should provide you with functionality to check if
### a user is logged in.

include_once("./example_user_api.php");

### THE MAGIC CONNECTION BETWEEN OWN WEBAPPLICATION AND PHORUM?? ###
### SO NEED TO SET A COOKIE IN OWN WEBAPPLICATION?? ###
### HOW ?? ###

### That is totally up to the main application. I presume that there is
### a login mechanism in place for that application. If you login,
### then that application will most likely setup a cookie to remember
### the session (possibly indirectly by means of a PHP session).
### What you need to do, is access the session information of the application.
### Forget the examples. Just find out what the main application uses itself
### for retrieving the logged in user.


... so here comes code that retrieves the actively logged in user for your app ...
... if you do not know how to get this code, then contact the support team for ...
... your app, since they might be able to tell you what code to use ...
... What you need to get out of this, is that you know if a user is logged in ...
... or not ...


### WHERE CAN I FIND THIS FUNCTION?? ###
$user_data = example_get_user_funtction($session); // ???

... Same story here. This is just a fictive function. It is definitely not a ...
... function that is part of your application. What you need to do, is ...
... retrieve the information for the logged in user from your main ...
... application. Again, this is dependent on the application and the ...
... way in which that application was built. It is not something that ...
... you can find in Phorum or that we can advice you on. ...


### What you need to do when you have chdir()ed to a different directory earlier.
chdir($curcwd);

It might be that the required user data is very easy accessible for your application (e.g. because for a logged in user, the application fills $_SESSION['user'] with all the data that you need), but we cannot provide you with a magic recipe, because this differs per application. I hope I made things more clear with my comments. The big challenge here so far is not the connection to Phorum, but retrieving the logged in user and its data for your main application from within the Phorum module.

Quote

"The file include/api/base.php is a standard file in the Phorum distribution, so it should be available for sure."
There is no include/api/ directory in my downloaded phorum script!
[edit]I had downloaded 5.1.25 ?? Downloaded newest version now (5.2.16RC1) [/edit]
[/quote]

That directory does exist for sure, because else we would have loads of problem reports about Phorum not working. Looking at the old release file, the directory did get included. This must be a broken upload or an accidentally removed include/api directory.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login