Support » Plugin: Admin Page Framework » Accessing Site Options

  • fredpik

    (@fredpik)


    hi,

    I’m working on a multisite installation.
    I’d like to retrieve saved options of a specific blog from another blog.
    There is a function getSiteOption() but I can’t figure how to send the blog ID as parameter.

    Could you help me?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author miunosoft

    (@miunosoft)

    Hi,

    I’m not sure what you mean by “send the blog ID”. Do you mean to get the blog ID? If so, just use get_current_blog_id().

    You can use the debug utility method to check the value.

    
    AdminPageFramework_Debug::log( get_current_blog_id() );
    

    Change the class name AdminPageFramework_Debug to yours with your class prefix for compiled versions.

    Don’t forget to enable WP_DEBUG. After loading a page, find the debug log file in wp-content.

    Thread Starter fredpik

    (@fredpik)

    On multisite, my plugin stores the option with key ‘APF_Option’ on every blog, in separate tables ‘prefix_blogid_option’.
    When I call getOption(), I get the value stored on the current blog table, but I want to display the option saved on another blog.
    For example, I’m on blog 1 and I want option stored on blog 2.
    I hope I’m clear enough…

    Thanks

    Plugin Author miunosoft

    (@miunosoft)

    Maybe,

    
    AdminPageFramework_Debug::log( get_blog_option( 3, 'APF_Option' ) );
    

    where 3 is the blog ID.

    Thread Starter fredpik

    (@fredpik)

    Yes, it’s the best way to do it.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Accessing Site Options’ is closed to new replies.