• Hi,

    I’m struggling to get this to activate on ‘after_switch_theme’ and always get a fatal error.

    I have set the kit to only allow access from my two staging domains but even this isn’t allowing the plugin to be activated on theme install.

    Any ideas?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter badscooter1980

    (@badscooter1980)

    This is the error message I’m getting;

    The Font Awesome plugin caught a fatal error.

    When trying to load Font Awesome, the plugin’s configuration was invalid. Try deactivating, uninstalling, and re-activating the Font Awesome plugin.

    Thread Starter badscooter1980

    (@badscooter1980)

    It is now activating, but still throwing up the above error?

    Plugin Author mlwilkerson

    (@mlwilkerson)

    Hi @badscooter1980 are you trying integrate the plugin with a theme? (Sounds like it).

    If so, have you taken a look at the example in the GitHub repo? It’s called theme-mu, and here is its functions.php. Because of the possibility of multiple clients of the plugin, there are some APIs to hook into at the Loader level that help to manage the initialization/activation/deactivation lifecycle in a way that maintains data integrity across the board.

    Plugin Author mlwilkerson

    (@mlwilkerson)

    That theme-mu example also bundles the plugin as a composer package. That aspect of the example may not be relevant, but the recommended usage for hooking into the Loader lifecycle is probably relevant regardless.

    Thread Starter badscooter1980

    (@badscooter1980)

    Super, thanks for responding. I’ll take a look ????

    Thread Starter badscooter1980

    (@badscooter1980)

    Thanks for that, all seems to be working.

    Is there a way to pre-populate the options on install, like API token etc?

    Plugin Author mlwilkerson

    (@mlwilkerson)

    Hmmm…good question.

    Do you mean that you’d like it that when a user configures your theme, that your theme can accept configuration options (like API token), instead of having to go to the Font Awesome settings page?

    In particular, the API Token is something that should only be supplied by the end user, not included in any code any where.

    Currently, there is no supported way to do that in the plugin’s PHP API. But you could probably do it using the REST API. In particular, the FontAwesome_Config_Controller has a /config route. You could send a PUT request to it with the configuration options you want (including the API Token). I see that the schema for that request is not documented, but you could you see what it takes by inspecting the network requests to /config in the browser’s network console that are issued when using the settings page.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Activation Failed on Switch Theme’ is closed to new replies.