phpBB3 hooks and phpbb 3.1

Discussion forum for Extension Writers regarding Extension Development.
Post Reply
User avatar
3Di
Former Team Member
Posts: 16151
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 Frankfurt 🇩🇪
Name: Marco
Contact:

phpBB3 hooks and phpbb 3.1

Post by 3Di »

A simple question before to start anything about that.

Porting a MOD (olympus) to extension, is it possible to use old hooks? And how?
As usual if somebody have examples (in case it is possible) to link to.. it is really appreciated. :)

Regards.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 27162
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: phpBB3 hooks and phpbb 3.1

Post by Paul »

While I don't know if if is possible out of my head, you really shouldn't use them but use the new events instead.
User avatar
3Di
Former Team Member
Posts: 16151
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 Frankfurt 🇩🇪
Name: Marco
Contact:

Re: phpBB3 hooks and phpbb 3.1

Post by 3Di »

Thank you Paul. :)

As a matter of fact I have not found anything related, by searching.

Here's is the hook itself: troll_hook and lurking at the availables list of events I thought maybe this core.session_create_after is the one I could be after.

But, I am in the dark. Still. :geek:
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
3Di
Former Team Member
Posts: 16151
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 Frankfurt 🇩🇪
Name: Marco
Contact:

Re: phpBB3 hooks and phpbb 3.1

Post by 3Di »

Hello all,
I am starting from a basic concept, could someone - please - tell me why in phpBB 3.1 still exists the hooks sytem in place? phpbb3.1/includes/hooks/index.php where nothing differs from phpBB3.0/includes/hooks/index.php, except from the file header itself. No code-changes.

There where does exists a more hooks related file in the phpBB3.1/phpBB//hook/finder.php that creates a new finder instance.

So, if I create a folder named hooks into the folder named core in my extension, should I be able to use the original Olympus MOD's hook (ofcourse after a code review)? Maybe including (-once ?) the related phpBB files? Wasting our time is not the option. ;)

It is just a thought. But, why does still exists the hooks mechanic if is not anymore used (not that has been so much ab-used in the past) ? For BC?

Thanks for the attention and reading. :)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
david63
Registered User
Posts: 19036
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: phpBB3 hooks and phpbb 3.1

Post by david63 »

I think, and I may be wrong, that hooks are still there for "backwards compatibility" but they are depreciated.
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored
User avatar
3Di
Former Team Member
Posts: 16151
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 Frankfurt 🇩🇪
Name: Marco
Contact:

Re: phpBB3 hooks and phpbb 3.1

Post by 3Di »

Yes, BC may be.

There is no notice/statement in everywhere tough.

I am going to explore the 3.2.0 "nightly builds" package.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
3Di
Former Team Member
Posts: 16151
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 Frankfurt 🇩🇪
Name: Marco
Contact:

Re: phpBB3 hooks and phpbb 3.1

Post by 3Di »

In 3.2.0 still the mechanic does exists, and in includes/functions_compatibility there is nothing about hooks.
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 27162
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: phpBB3 hooks and phpbb 3.1

Post by Paul »

Again, you really should not use them. Simply use the event system in 3.1 and later.
User avatar
3Di
Former Team Member
Posts: 16151
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 Frankfurt 🇩🇪
Name: Marco
Contact:

Re: phpBB3 hooks and phpbb 3.1

Post by 3Di »

Paul wrote:Again, you really should not use them. Simply use the event system in 3.1 and later.
Thank you Paul, nonetheless it is a good question, mine.

Anyway, I already answered here to your first and present answer.

Thx. :)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
nicofuma
3.2 Release Manager
3.2 Release Manager
Posts: 546
Joined: Sun Apr 13, 2014 1:47 am
Location: Grenoble - France

Re: phpBB3 hooks and phpbb 3.1

Post by nicofuma »

Why it still exists? well... I guess no body ever created a ticket to removed it and people forgot it even exists.
Member of phpBB Development-Team
No Support via PM
User avatar
3Di
Former Team Member
Posts: 16151
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 Frankfurt 🇩🇪
Name: Marco
Contact:

Re: phpBB3 hooks and phpbb 3.1

Post by 3Di »

nicofuma wrote:Why it still exists? well... I guess no body ever created a ticket to removed it and people forgot it even exists.
I see, interesting. I can not create one because I can't login to the tracker. I noticed the Website Team long ago but still the problem persists. Thanks for your reply nicofuma. :)

Back to the problem, I found this in the tracker: core.user_setup_after that seems to be exactly what I was looking for, interesting also the comment I read there:
I don't know if the event must be called core.user_session_handler or core.user_setup_after...
Anyway, has been merged and available since 3.1.6 RC1.

I will give it a try.

Thanks everybody :)
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
User avatar
3Di
Former Team Member
Posts: 16151
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milano 🇮🇹 Frankfurt 🇩🇪
Name: Marco
Contact:

Re: phpBB3 hooks and phpbb 3.1

Post by 3Di »

nicofuma wrote:Why it still exists? well... I guess no body ever created a ticket to removed it and people forgot it even exists.
Or maybe because it is still in use? At least into the install/database_update.php file?

Code: Select all

// Add own hook handler, if present. :o
if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))
{
    require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
    $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display')));

    $phpbb_hook_finder = $phpbb_container->get('hook_finder');
    foreach ($phpbb_hook_finder->find() as $hook)
    {
        @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx);
    }
}
else
{
    $phpbb_hook = false;
}
Just out of curiosity, nothing less nothing more. :)

Why do I have to reinvent the wheel? In case..
🆓 Free support for our extensions also provided here: phpBB Studio
🚀 Looking for a specific feature or alternative option? We will rock you!
Please PM me only to request paid works. Thx. Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user º Extensions, Scripts, MOD porting, Update/Upgrades
nicofuma
3.2 Release Manager
3.2 Release Manager
Posts: 546
Joined: Sun Apr 13, 2014 1:47 am
Location: Grenoble - France

Re: phpBB3 hooks and phpbb 3.1

Post by nicofuma »

Well it may be present but we don't use it
Member of phpBB Development-Team
No Support via PM
Post Reply

Return to “Extension Writers Discussion”