WordPress.org

Support

Support » Plugins and Hacks » Groups » [Resolved] Multisite Groups WooCommerce

[Resolved] Multisite Groups WooCommerce

  • Is it possible to check from a SUBSITE within a network whether or not the current logged in user is in a specific group on the MAINSITE.

    When users purchase items in WooCommerce, I have it so that it promotes them to a ‘Premium’ group. However, this only occurs on the MAINSITE within my network and NOT the subsite. This is causing me problems as I must know whether they’re in the ‘Premium’ group on all sites within my network.

    http://wordpress.org/plugins/groups/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Solved with the following code:

    <?php

    $blog_id = 1; //set the blog id to the main site id

    switch_to_blog( $blog_id );

    $user_id = get_current_user_id();
    $group = Groups_Group::read_by_name( ‘Premium’ );
    if ( Groups_User_Group::read( $user_id, $group->group_id ) ) {
    echo ‘PREMIUM!!’;
    } else {
    echo ‘Not premium’;
    }

    restore_current_blog();

    ?>

    Plugin Author itthinx

    @itthinx

    Thanks for sharing your solution 🙂

    Do I need to create the group on the subsite with this code or will it automatically create the group in the subsite and assign the user to that subsite?

    Also where does this code go?

    Is there a way to sync all groups in all subsites/mainsites so that members are always in the same group no matter which site they are in?

    I would pay to have this added!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Multisite Groups WooCommerce’ is closed to new replies.
Skip to toolbar