• I’ve set a number of groups in relation to category names,

    Now I’m trying to give user access page content by getting the category name and matching it to the user group?

    <?php
    $user_id = get_current_user_id();
    $groupname = get_single_cat_title();
    $group = Groups_Group::read_by_name( $groupname );
    if ( Groups_User_Group::read( $user_id, $group->group_id ) ) { 
    
    echo 'access granted';
    
    } else {
    
    echo 'access denied';
    
    }
    ?>

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Tom Parkes

    (@tomparkes)

    I have sorted the issue now, now another problem is can I set an array in the group variable?

    $group = Groups_Group::read_by_name(array ( $groupname, $group ));

    Hi Tom,
    How did you solve your first post above – I need to achieve that too!
    Many thanks for sharing your solution!
    Liz

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

The topic ‘Give user access by category name’ is closed to new replies.