For Custom Modules - The Advanced Settings Tab Is MIA

When I noticed that none of my custom modules where getting the “Advanced” tab, I wondered why. I could not find anything dealing with this in “Pro” version custom modules docs / examples either. So, I did some looking around in the BB source and found the following…

The Advanced Tab “should be” automatically added to any registered module according to the area of the code I looked at but they just weren’t. The custom modules as well as the BB example modules weren’t getting it either though. So, since none of the official examples displayed the “Advanced” tab either, I decided that pretty much ruled out any issues of my own that might be at fault (to reduce possible variables in play at that time). Modules that were outside the main BB plugin just weren’t getting the same treatment as those within.

After some more investigation, I determined that the file “module-settings.php” was responsible for loading the missing settings tab. I then also realized that the static public function load_settings of the class FLBuilderModel was responsible for loading that file. It was only when I finally looked into how that static method was executed that I saw the cause of the bug.

The following line in fl-builder.php is…

add_action(‘init’, ‘FLBuilderModel::load_settings’, 1);

but needed to be (in order to work)…

add_action(‘plugins_loaded’, ‘FLBuilderModel::load_settings’, 1);

Why? This function was getting called too early / before all plugins had finished loading (more importantly - the separate plugin containing the custom modules). So, immediately after making this change…it finally worked!

Rather than have to hack the core plugin until the next update (even if this is NOT deemed a bug), I also found a workaround which I will use for now. The callback function for action hook that loads the modules that came with the examples was “init” and has now been changed to “plugins_loaded” for the custom modules plugin.

While this hook change better ensures that the BB plugin and it’s classes are available when a 3rd party plugin needs them, it wasn’t enough by itself of course. So, in the action hook callback function, I also added a call to “FLBuilderModel::load_settings();” After that, the unmodified core BB plugin “as-is” (restored to previously unmodified state by deletion / fresh re-install) worked the same way as when I had manually modified it. Goal achieved from 3rd Party plugin with no changes to BB neccessary. Awesome! :slight_smile:

Another function “load_modules” is being loading the same way (at wp init) but as of now, I don’t know what 3rd party plugin issues (if any) that may be causing having not investigated that part of the plugin. I probably won’t unless I have to either.

I leave it up to you guys know about what to do. Might I suggest one of the following paths / actions…

A) Change documentation / examples that “Custom Modules” to use “plugins_loaded” and the separate “load_settings” call.

B) Change the core plugin itself to not need such modifications by 3rd parties.

Hey Matthew,

Wow, thanks for the incredibly detailed write up! I’ll do some testing and make sure to have a solution in place for the next release.

Justin

You’re definitely welcome. I’m trying to help you help me (and anyone else that might be affected) is all. :slight_smile:

Please try to post any findings you’re comfortable releasing before the update if it will be a while before then because I’m very curious even now about your own findings and ultimately, the chosen direction you’ll take.

While new to BB, I’m enjoying playing with things and seeing what breaks / is broken custom module wise. :wink:

I also added a related “User Voice” suggestion for “Enabled Modules” that hopefully should clean the wp admin (backend) settings area up when several 3rd party modules are loaded. I’m hopeful it makes it into the next release as it would seem far less complex than many of the other requests. However, I also realize that’s really not for me to judge. Lol.

Thanks for the reply!

Hey Matthew,

I’ll definitely post here when I figure out the issue. There are quite a few items I’m working on right now, and I’ll be out for a short vacation next week, so it could be a few weeks before the next release.

I also added a related “User Voice” suggestion for “Enabled Modules” that hopefully should clean the wp admin (backend) settings area up when several 3rd party modules are loaded. I’m hopeful it makes it into the next release as it would seem far less complex than many of the other requests. However, I also realize that’s really not for me to judge. Lol.

I saw that one, thanks for the reminder! You’re right that it should be fairly easy to clean up. I’ve made a note to look into that as well.

Thanks,
Justin

Hey Matthew,

I looked into this and it appears to be working fine with the example modules. I don’t believe the issue is with the load order. Can you shoot me a copy of your custom module plugin to test? My email address is justin [at] fastlinemedia [dot] com.

Thanks!
Justin

Thanks for looking into it so quickly! Those are interesting findings indeed.

Since the issue happens even when using the (unmodified) free / pro BB plugin and example modules for me, any custom modules I have made are likely irrelevant. I have deactivated them anyway (as they’re in a separate plugin) and only have the examples activated.

It may have more to do with the local WP environment I’m using then (XAMPP on Win 7 with PHP 5.4.29). I’m using the Twenty Twelve theme with only BB and the examples plugin active when testing. So, I’ll have to look into this more myself before potentially wasting any more of your valuable time.

Best regards,
Matt

Hey Matt,

That’s a good point. Let me know what you find. Also, I just finished the code to categorize modules in the backend. :slight_smile:

Justin

Awesome! Have you perhaps pushed that to some branch on the public git yet by chance? I’d love to try that too. Otherwise, no worries. :wink:

Hey Matt,

We don’t have a public repo but it will be out in Sunday’s release.

Thanks,
Justin

I was referring the public repo for the lite version that’s on WP.org since I figured this organizational change would likely affect all BB levels.

No problem. I know you’re probably a bunch of busy beavers over there. Sunday is great! :slight_smile: