News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Integration hooks for 2.1

Started by Night09, December 22, 2014, 07:25:06 PM

Previous topic - Next topic

Night09

Ive been writing some code for a mod and have contained all my menu functions in a modify file seperate to the SMF install so it just calls that file for the settings ect.  The problem ive got is in admin.php where a mod writer is supposed to add the code we have this message:

Quote// Mod Authors for a "ADD AFTER" on this line. Ensure you end your change with a comma. For example:
                        // 'shout' => array($txt['shout']),
                        // Note the comma!! The setting with automatically appear with the first mod to be added.

Further down we have:
Quote// Mod authors if you want to be "real freaking good" then add any setting pages for your mod BELOW this line!

Now ive been able to add my block of code which gives me the right admin menu change and an icon but isnt there a way for this code to be in my file and just hooked into the admin menu?

Im looking at this because I want to get the full menu and settings standalone so it doesnt get trouble from themes and the likes. Technically isnt there a way to add admin menu items purely on hooks alone?  Im not sure how its called if it doesnt actually modify  the file to begin if that makes sense.

Diego Andrés

Quote// Mod authors if you want to be "real freaking good" then add any setting pages for your mod BELOW this line!

Just a few lines below is a hook for that

Quoteintegrate_admin_search

SMF Tricks - Free & Premium Responsive Themes for SMF.

margarett

* margarett thinks we should remove the "Mod authors" reference as we will be forcing the usage of hooks more and more...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Arantor

That depends if you're planning on encouraging the use of 2.0 mods on 2.1 where they still depend on such things.

Night09

This im doing is from the ground up and has no code prior. The menu works fine but ive had to add an array to the admin.php because I dont know how im supposed to place it in my file instead and call it using the hook.

Have we got any 2.1 examples about ?

Arantor

Considering that there are 2.0 examples of using hooks and have been for years? Nothing 2.1 specific required here.

live627

Quote from: margarett on December 22, 2014, 07:42:32 PM
* margarett thinks we should remove the "Mod authors" reference as we will be forcing the usage of hooks more and more...
and break tons of mods? Bad idea.

Night09

I wasnt sure if there was 2.1 specific changes tbh.

Ive just been reading over some older topics on the subject and it appeared that there was debate over what will and wont work.

vbgamer45

Quote from: live627 on December 22, 2014, 07:56:07 PM
Quote from: margarett on December 22, 2014, 07:42:32 PM
* margarett thinks we should remove the "Mod authors" reference as we will be forcing the usage of hooks more and more...
and break tons of mods? Bad idea.
Agree. In the end that just causes people to leave. As developer I like backwards compatibility is less work to maintain... Why keep rewriting code over again I really dislike it when changes are made for no good reason.  Part of the reason why windows was successful is for the most part had a stable api. New companies like facebook like changing their api all the times and results in people less likely to keep going which is part of the reason why SMF doesn't have social logins.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Arantor

QuoteAs developer I like backwards compatibility is less work to maintain...

Only if actually used properly in the first place.

QuoteWhy keep rewriting code over again I really dislike it when changes are made for no good reason.

The changes were always made with good reason, just because you don't necessarily know or understand the reason does not mean it wasn't a good one.

QuotePart of the reason why windows was successful is for the most part had a stable api

You are clearly joking. WinAPI has had many changes under the hood and more than once did not function as described in MSDN documentation. To the point where compilers include compatibility code specifically for different versions of Windows precisely because the API differs from version to version.

vbgamer45

I can take an application written in the 1980s in windows and it sill works today on windows.

No a lot of the changes are made for dumb reasons mainly deprecating functions when there is no real good reason all it does end up breaking code which used to work and now in the end doesn't work and is just a waste of developers time.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Arantor

QuoteI can take an application written in the 1980s in windows and it sill works today on windows.

Nope, but thanks for playing. Nothing built for Win3.1 or lower will work on current Windows unless built for Win32s since the 16 bit functionality has been phased out.

I also have applications I wrote that followed the API as laid down in Windows 98 that behave differently on more recent versions - and some API functions which didn't behave as per documentation in Win98 but did in XP.

QuoteNo a lot of the changes are made for dumb reasons mainly deprecating functions when there is no real good reason

Like I said, just because you don't know *their* reasons for it does not make them inherently bad reasons.

I suspect you're part of the group that feels EOLing SMF 1.1 is for no good reason, for example, when I can give you a ton of them.

vbgamer45

Forgot that 16bit was dead I have not tired in a couple years but I do remember downloading apps on Windows xp that at least that were made in the 1980's that still worked which was awesome. Amazing that you can remember all that even Win32s that was a very small subset.

Honestly yeah SMF 1.1.x shouldn't be EOL it still works and should have at least security updates. if I had my say I would have updated but people didn't like me adding/updating to it at the time... 2.1 is the future just we need to be very careful...each new version lately we loose people it seems either forum owners/modders/themers.  We need to do a better job on making people feel welcome otherwise they won't come around....
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Arantor

QuoteAmazing that you can remember all that even Win32s that was a very small subset.

It's been a while since I did the WinAPI coding thing, I stopped in 2001 when I started getting into the web thing but even then the desktop API was starting to really be fragmented; though XP harmonising everything under one kernel (also meaning the whole needing pairs of functions for anything, one for ASCII, one for Unicode, could safely FOAD) would certainly have started to deal with the frustration I was having. Vista chopping the old security model and driver model is another of those 'seems to have been bad' moves but actually wasn't because it is what made 7 that much stronger, even though it might not seem like it.

QuoteHonestly yeah SMF 1.1.x shouldn't be EOL it still works and should have at least security updates.

Even though it is massively impractical to do so since almost every mod will also need some kind of updates?

With PHP 5.5, ext/mysql is being phased out meaning that all the mysql_fetch_assoc calls throughout SMF will need replacing, and putting in something like this is not actually workable in practice:

if (!function_exists('mysql_fetch_assoc'))
{
  function mysql_fetch_assoc($resource)
  {
    return mysqli_fetch_assoc($resource);
  }
}


(and fixing db_query to return mysqli_result objects instead of classic resources, of course)

As for phasing out ext/mysql, it might sound like it's a bad move because backwards compatibility. Except there are reasons MySQLi was introduced - the whole GPL licensing crap with PHP and MySQL aside, there are features in MySQLi that cannot be introduced into the ext/mysql branch simply because it would have to be ground-up rewritten to do it like supporting unbuffered queries (which for some stuff is fantastic to be able to do). Like I said, just because the reasons are not apparent or well understood does not necessarily follow that the reasons are bad.

It is not possible nor practical to maintain things forever. Sometimes things just have to be replaced. By your logic, all the code in 2.0 that makes it hard to theme should *also* be kept for future versions, despite better alternatives being available.

One cannot make use of new features and new opportunities without removing some of the cruft from time to time.

This is however massively off the original topic :P

margarett

Quote from: live627 on December 22, 2014, 07:56:07 PM
Quote from: margarett on December 22, 2014, 07:42:32 PM
* margarett thinks we should remove the "Mod authors" reference as we will be forcing the usage of hooks more and more...
and break tons of mods? Bad idea.
I actually think so. Most mods will not work in 2.1 except if using hooks already... So if we could help ourselves, it would be nice ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Kindred

Nope... Removing that for 2.1 goes contrary to the plan. :P
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Arantor

I have to be honest while I can see the argument in favour of not breaking back-compat for the sake of it, I'm inclined to be... encouraging... of mod authors looking back over their mods and not doing the least possible work to provide something for 2.1.

Certain people will know *exactly* what I have in mind like doing what looks like find/replace on db_query to get to $smcFunc['db_query'] and not making use of the features in $smcFunc['db_query'] put there for security.

Advertisement: