• Resolved Mikko Saari

    (@msaari)


    Hi,

    I’m looking into adding Groups support in Relevanssi search plugin, so that the search would only return those posts the user is allowed to see.

    Looks like this is the way to check whether a user is allowed to see a post, am I right?

    $user = wp_get_current_user();
    $access = Groups_Post_Access::user_can_read_post($doc, $user->ID);

    What would you suggest to be the best way to check whether Groups is installed or not?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Mikko,

    Yes correct, you can check the user access that way. The method’s full description is in the API.

    In order to check if Groups is active, i would use

    $active_plugins = get_option( 'active_plugins', array() );
    $groups_is_active = in_array( 'groups/groups.php', $active_plugins );
    if ( $groups_is_active ) {
    
    }

    or this

    if ( defined( 'GROUPS_CORE_VERSION' ) ) {
    
    }

    Kind regards,
    George

    Thread Starter Mikko Saari

    (@msaari)

    Thanks! Next versions of Relevanssi and Relevanssi Premium will include automatic support for Groups.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Groups support for Relevanssi’ is closed to new replies.