• Resolved LostInNetwork

    (@lostinnetwork)


    I need to modify a plugin to suit my needs. To achieve this I need to check if another plugin is installed. How do I do that?

    I tried to search the forums and codex, but somehow I could not find any instructions.

Viewing 7 replies - 1 through 7 (of 7 total)
  • How about function_exists()?

    for example:

    if (function_exists('UTW_ShowTagsForCurrentPost')) {
       //do stuff
    }

    That’s one I used to use before 2.3 came out

    Thread Starter LostInNetwork

    (@lostinnetwork)

    I need to assign $variable=$post->language;
    There is no function involved, obviously.
    I could of course pick a function at random, and test it. Then I would be testing the wrong thing, though.

    The variable can be empty or contain data, but I don’t want error messages. I haven’t learned php enough to discard error messages, so I was looking for a simple existence check as a quick fix.

    So the plugin that you want to check for doesn’t have any functions of it’s own?

    I hadn’t run into one like that. Sorry to have consumed bits. :-\

    Thread Starter LostInNetwork

    (@lostinnetwork)

    I’m trying to make Gengo work with Eventcalendar3.

    Gengo delivers the data structures I need, but it doesn’t have the functions I need (or the documentation that I would need). Either I hack Gengo, or access the data without building functions of my own.

    Gengo has lots of functions such as the_language, the_translations, the_translator… Let’s assume that I do a function_exists(the_language) check. The existence of that function does not necessarily mean that Gengo would be installed. It could be just about any plugin that has a the_language function. I want to make sure that the language that is read from the post, is indeed valid data, and that it doesn’t cause any errors.

    Anyway, if there is no is_installed() function or similar, then I must just pick some random function. Maybe I’ll find some function that has a unique name, does not get renamed or dropped 🙁 Or make my own (allready did, but that’s really unorthodox way of doing things)

    What about something like this?

    Granted, I’m not a pro coder – but wouldn’t an active plugin show up in the Plugins panel?

    Thread Starter LostInNetwork

    (@lostinnetwork)

    Thank! That was just what I was looking for.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Checking for plugin install status?’ is closed to new replies.