• Hi…

    I’m trying to make a plugin but I’m stuck.

    When initializing the plugin like so:
    add_action('plugins_loaded', 'myInitFunction');

    I want to parse a variable through the ‘myInitFunction’. S o basicly is has to do this: myInitFunction($sSomeString);

    I did search this forum and googled and stuff… maybe I was searching wrong or maybe it’s just not possible.

    gr…

    Sjeiti

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sjeiti — Can you give more detail? Where is this variable coming from?

    Thread Starter Sjeiti

    (@sjeiti)

    Detail… I don’t see how that could clarify the question but here goes: I’ve build a sparkline library with which I want to be able to make multiple widgets. Now the input for the widget could be a static list but could also be a variable one (sql query and some data alteration). Since it’s a bit hard to put such a sql query into an options-form I thought it would be better if people just copied the php plugin source and altered the sql query to their needs. But most of the php files would be similar apart from the data retreival (and renaming all the functions) so I thought why not just have these files include one other where all these similar functions reside. So the files would just have a $uniquename variable, the include, and then the data retreival function (which will probably have to be renamed to suit the unique name). But then I’d have to be able to parse the unique name variable through functions like: add_action (and maybe register_sidebar_widget and register_widget_control).
    I think the first post was less confusing.

    Sjeiti,

    Did you ever figure this out? I was wondering the same thing.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Try something like this:

    add_action('plugins_loaded', create_function('$sSomeString', 'myInitFunction($sSomeString)'));

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘parse variable through add_action’ is closed to new replies.