Skip to content

Instantly share code, notes, and snippets.

@pranali333
Created July 13, 2017 09:05
Show Gist options
  • Select an option

  • Save pranali333/c92dea38d3d997075b694b4ef28e767e to your computer and use it in GitHub Desktop.

Select an option

Save pranali333/c92dea38d3d997075b694b4ef28e767e to your computer and use it in GitHub Desktop.
List media from the groups of which a currently logged-in user is a member
<?php
/**
* It will first identify that currently logged-in user is member of which group and pick up the first group
* if there are more than one.
**/
$user_id = get_current_user_id();
$user_groups = (groups_get_user_groups($user_id));
$user_groups = $user_groups["groups"];
echo do_shortcode('[rtmedia_gallery media_type="music" context="group" context_id="'.$user_groups[0].'"]');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment