• Resolved thisislawatts

    (@thisislawatts)


    Heya,

    I am looking at putting together a query for posts that the current user has access to. So my thought process was that first I’d have to establish current user’s capabilities then build a WP_Query off of that. However I seem to be stuck at the first hurdle with $user->__get(‘capabilities’) returning NULL.

    Is there any reason this would be happening/better way to query the posts.

    $user_id = get_current_user_id();
    $user = new Groups_User($user_id);
    $groups = $user->__get('groups');
    
    // Get Current user capabilities
    $caps = $user->__get('capabilities');

    https://www.ads-software.com/extend/plugins/groups/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Current User Capabilities’ is closed to new replies.