Forums / Developer / Custom Hooks for User Creation (integrator module for forums, etc)

Custom Hooks for User Creation (integrator module for forums, etc)

Author Message

Simon Phillips

Monday 21 February 2005 4:25:21 pm

Hi,

I'm developing a authentication integrator for eZPublish, and so am building in a number of custom hooks into the kernel to catch events such as user creation, deletion, password change, logon, etc. This will then call the integrator code to make appropriate changes to the other software's user table and session variables. I intend to use the code to integrate phpBB, but pretty much any other software that has a database user table and uses cookies/sessions for login should work.

All's going reasonably well, and I hope to have a working phpBB solution pretty soon - and I'll post the code here, no worries.

I'm having a few problems hooking into the ezuser creation process though. There isn't an obvious function in ezuzer that's called on user registration, so I've been doing it through the code in kernel/user/register.php. However, none of this code is run if a user is added through the admin interface - it's only called for a self-registration process.

<b>How can I spot content class creation</b> and spawn custom code based on this? Are workflows the best thing for this? Or is there another function that's run if a user object is created through the admin interface?

One other thing - while the rest of my hooks have access to the details of the current user logged on, my logout hook can never see the currently logged in user - even if I put my

$currentUser =& eZUser::currentUser();

code right at the start of the logoutCurrent() function of eZUser. The code's being run, but I'm always getting an anonymous user returned - and this is before the logout code has been processed. Any ideas on how to find the user being logged out? I've tried almost <b>everything</b>!

Thanks,
Simon

kracker (the)

Monday 21 February 2005 7:13:03 pm

Simon,

I think it's really great that your working on this! So please don't give up, we're here to help, even if it doesn't always work quite right.

Now I'm sure this isn't really the "right" way to go about this but, you could check the files in kernel/content/ like kernel/content/edit.php which is used for content creation / edit (a user object is simply a content_class type, right?). You could in theory add some code to check for creation / edit of eZUser content objects (i think user class id is 4).

I saw this code and it gave me this idea (from the edit.php in kernel/content)

$classID = $obj->attribute( 'contentclass_id' );
$class =& eZContentClass::fetch( $classID ); 

I think that if you go this route you'll be able to archive the goal but I think there has to be a cleaner way.

Nevertheless, <b>do not</b> stop, keep hacking it till it works. With a working implementation we can refine the process until we have a drop in extension which does it cleanly. I can't stress enough how many people will flat out lov ya for what your doing here.

If you have any other questions or want some help in real time. I'd be very willing to help talk this through, I'll be in my room (<grin> which is #ezpublish on IRC Chat) You should check out the irc channel some time. We have about 10 people on regularly and we are looking for more people ....
Here is a guide: http://ezpub.co.uk/about/contact/irc

cheers,
//kracker

Sage Francis : Bridle

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Brendan Pike

Monday 21 February 2005 8:01:22 pm

The topic of integrating forum solutions like phpBB is an interesting one that I've been pondering of late. It seems to me that while you would get a more mature forum system you are then departing from some of the benefits by retaining a centralised content framework. Data relationships weaken, search integration and all the complex permissions get bypassed, unless that is you can find a way for phpBB to actual utilise eZ publish classes which seems absurd.

I've compared a few forum systems and found that eZ publish is capable of "mostly" matching everything that they do and perhaps even offer more in other ways. However the default forum templates do need to be developed a lot further before we see the fuller possibilities been utilised.

The same applies with newsletter systems IMHO, there has been some positive movement of late but still nothing that is able to persuade users to not intergrate things like MailGust.

It's certainly great to development in these areas, wether you prefer 3rd party intregration or recreation.

www.dbinformatics.com.au

We are always interested in hearing from experienced eZ PHP programmers and eZ template designers interested in contract work.

kracker (the)

Monday 21 February 2005 8:17:59 pm

Ok so... my last reply kinda sucked so I'll just try try again.

What I was trying to say is, lets hash out the in's&out's of how best to implement the code you want to add in a real time chat as it will help make understanding where both of us are coming from move forward much more quickly.

While I'm not a super eZ publish kernel hacker, I know enough to get myself into trouble and usually get the job done, at the very least I think I can help you get past your current breakdowns and moving forward again.

The flip side is there are a number of ways to do what you want to do, I'd like to understand a little better what path you have already chosen so I my suggestions are not out in right field...

About 10min into looking into code I got some more ideas but I hate to create more confusion by giving them if your already either past where I'm at or if you have chosen another route ... *sigh*

I get the impression your thinking of hacking eZ publish to update the external forum's (phpBB) database records when new users are created via the admin or user's registration. I think that could work, it might even be more useful to also have some code which will populate the external forum's (phpBB) database records for the first time (for sites which already have a large number of eZ publish users).

As for Brendan's Reply, I would say that there are different solutions for different people. While I am making a list of things that could be improved with the default eZ publish forum templates to help bridge the gap between it and other forum solutions, I know that won't completely satisfy people who are already deeply invested into an alternate existing solution.

I think the community can withstand the availably of options; The option to use eZ publish forums or link eZ publish with another external solution.

Well, I'll cut this short for now. <i>Patiently Waiting</i> your reply ...

//kracker

Sixtoo : The Canada Project Featuring Sage Francis
http://www.akmcs.com/audio/hha%20promo/02%20fallen%20angels.mp3
http://www.akmcs.com/audio/hha%20promo/03%20letters%20to%20no%20one.mp3

<b>References:</b>
http://www.google.com/search?hl=en&q=site%3Aez.no+phpBB&btnG=Google+Search
http://www.ez.no/community/forum/install_configuration/intergrating_ezpublish_and_phpbb
http://www.ez.no/content/advancedsearch?SearchText=phpBB&SearchDate=-1&SearchPageLimit=6&SearchContentClassID=14&SearchButton=Search
http://www.ez.no/community/forum/general/integrating_ez_with_ie_phpbb_suggestions
http://www.ez.no/community/forum/developer/manually_adding_users_from_external_app
http://www.ez.no/community/forum/developer/nicer_forum_templates

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Bruce Morrison

Tuesday 22 February 2005 7:49:27 pm

I'm having a few problems hooking into the ezuser creation process
though. There isn't an obvious function in ezuzer that's called on user
registration, so I've been doing it through the code in
kernel/user/register.php. However, none of this code is run if a user is added
 through the admin interface - it's only called for a self-registration process.

How can I spot content class creation and spawn custom code based on this? Are
 workflows the best thing for this? Or is there another function that's run if
 a user object is created through the admin interface?

Had a brief look at kernel/user/register.php and it ends up creating a user object just it is done via the admin interface but with some limitations (a good place to look at the code for genrating an object).

Because it uses the same method as for the admin interface it will be subject to the same workflows.

I'd create a workflow that was run after publishig of the object that did the usersetup for the 3rd party app. That way it would work for users created via
the admin interface and via the user/register url.

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Brian Baxter

Saturday 30 June 2007 4:02:43 pm

any further development ever happened to this, maybe for use with other forums as well other than phpbb?

Behind every great fortune lies a crime.
http://www.3cwired.com - Web Design/SEO/Repair/Sales/Upgrades
http://www.galants.org - The Home for Galant Enthusiasts
http://www.locatemyip.com - More than just free IP displays

Andrew Duck

Sunday 01 July 2007 8:39:57 am

Whilst in agreeance with the points made by Brendan regarding retaining a centralised framework we have recently migrated a client to phpBB at their request and subsequently have had to integrate logins between phpBB and eZ publish.

For our implementation we have utilised eZ publish as the user control system and implemented authentication hooks into the upcoming phpBB3 to allow you to authorise users against the eZ publish system and still be able to maintain user profiles/signatures etc within the phpBB system if required. User signup is forced via eZ publish even from within the phpBB instances.

This code is a work in progress and is undergoing modification at the moment to suit additional requested functionality. If anyone is interested give me a buzz and we may be able to release the code.

Andrew Duck, Executive Director, Quiqcorp Limited
eZ Certified Developer and Trainer.
Member of the Community Project Board
http://quiqcorp.com | http://twitter.com/andrewduck