• Hello everyone,
    at first: thanks for this simple and yet very useful plugin. My question is: For your next release, could you maybe add the blog_id or something to the filename where the variables are stored? Then the plugin would be able to be used in multisite installations. Unfortunately there is no way to contribute code yet…

    Best regards!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author akirak

    (@akirak)

    Hi @tfr79 ,

    Thanks for the idea!
    Though I was wondering what exactly you would like to accomplish by this or what problem you are having now.
    Using different values for the same key between sites is a use case that I can think of.
    Hearing your use cases will give me better idea for the requirements.

    Akira

    Thread Starter tfr79

    (@tfr79)

    Hi @akirak, when we use your plugin on different websites of a multisite WP installation, all sites read the cgv values from the same database file. So if I define a cgv variable like “super_secret” = 12345 on one of the websites, this variable is immediately visible on any other website of the multisite network as soon as the cgv plugin is activated on that other site. And thus any change to the value affects any usages within the multisite network.

    In concrete we have prices with the same name but with a value that differs slightly between different websites of the network. This is currently not possible with cgv.

    One might rather want to keep those variables private for a single website inside the network. So my suggestion is to add sth. like get_current_blog_id() to the filename in order to keep cgv values separated from different blogs.

    • This reply was modified 3 years, 8 months ago by tfr79.
    Plugin Author akirak

    (@akirak)

    Thank you for sharing your use cases, @tfr79 .
    I agree it’s better to provide multisite functionality which can override a value for any single multisite.
    It’s not a quick development so I’m not sure I can give you timeline.
    Or if you can contribute code, that would be good starting point for me..

    One thing I want to emphasize is that you shouldn’t put any secret info in this plugin’s config.
    As you see the code, the variables are not stored in DB and it can be viewed if the hash name is guessed properly.

    Thread Starter tfr79

    (@tfr79)

    Thanks for your time sharing your thoughts on this @akirak – from my knowledge you would just have to change line 19 to sth. this:
    $this->file_path = WP_CONTENT_DIR . '/custom-global-variables/' . md5( AUTH_KEY ) . (is_multisite() ? ('-'. get_current_blog_id()) : '') . '.json';

    Plugin Author akirak

    (@akirak)

    Thanks for the code, @tfr79 .
    I am thinking of providing a set of variables for all sites and sets for individual sites.
    The current implementation will stay as is, to cover a set for all sites.
    This way, we can make sure not to cause any regressions for existing installation and individual site can override base value for certain key.
    I will let you know when this is available but it will take some time.

    I would love to have this functionality too! I was going to use the variables in my child sites as well.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Multisite support’ is closed to new replies.