WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Checking for plugin install status? (8 posts)

  1. LostInNetwork
    Member
    Posted 6 years ago #

    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.

  2. Chris_K
    Member
    Posted 6 years ago #

    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

  3. LostInNetwork
    Member
    Posted 6 years ago #

    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.

  4. Chris_K
    Member
    Posted 6 years ago #

    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. :-\

  5. LostInNetwork
    Member
    Posted 6 years ago #

    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)

  6. Chris_K
    Member
    Posted 6 years ago #

    What about something like this?

  7. brockangelo
    Member
    Posted 6 years ago #

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

  8. LostInNetwork
    Member
    Posted 6 years ago #

    Thank! That was just what I was looking for.

Topic Closed

This topic has been closed to new replies.

About this Topic