Get Group by Group ID

 I'm trying to pull individual groups using the below code. I have another page that produces a link with the group ID and I'm able to pull the id from the url, but when I use the below code it doesn't pull data for that specific group or any group. 

parse_str ($str);
echo $id;

$results = $elvanto->call('groups/getAll/',array('id'=>$id));

$new_results = $results->groups->group;


Hi Steve.

Two things you'll want to do differently.

  1. Change the endpoint from groups/getAll to groups/getInfo.
  2. You'll want to change $new_results as the information is structured differently with the new endpoint.

$new_results = $results->group->[0];

 This should work.


Thanks. Now it's not outputting anything whereas before I just wan't getting any of the data. Now I'm not getting any of the HTML. I must be missing something.


$auth_details = array('api_key' => 'xxxx);
$elvanto = new Elvanto_API($auth_details);

parse_str ($str);
echo $id;

$results = $elvanto->call('groups/getInfo/',array('id'=>$id));

$new_results = $results->group->[0];


Try this.

$results = $elvanto->call('groups/getInfo/', $params=array('id'=>$id));

Still not working. When I comment out 

$new_results = $results->group->[0];

 I get the HTML for the body, but not with the above line. 

Here's the code that we used and it works now.  

$elvanto = new Elvanto_API($auth_details);


$groupResult = $elvanto->call('groups/getInfo', $params=array("id"=>$id, "fields" => array("locations", "categories")));
$groupList = $groupResult->group;

<div class="views-group-wrapper">
	<div class="views-group-text-wrapper">
		<div class="views-group-title-wrapper"><?php echo $currentGroup->name; ?></div>
		<div class="views-group-category-wrapper"><i class="fa fa-search views-category-wrapper" aria-hidden="true"></i><?php
				$categoryNames=array_map(function($category) {return $category->name;}, $currentGroup->categories->category);
				echo implode(", ", $categoryNames);
		<div class="views-group-overview-wrapper"><?php echo $currentGroup->meeting_address; ?></div>	
		<div class="views-group-subtitle-wrapper" style="padding-top:20px;">WHEN & WHERE</div>
		<div class="views-group-category-wrapper"><i class="fa fa-calendar-o views-category-wrapper" aria-hidden="true"></i>  <?php echo $currentGroup->meeting_day; ?></div>
		<div class="views-group-category-wrapper"><i class="fa fa-clock-o views-category-wrapper" aria-hidden="true"></i> <?php echo $currentGroup->meeting_time; ?></div> 
		<div class="views-group-category-wrapper"><i class="fa fa-map-marker views-category-wrapper" aria-hidden="true"></i><?php
				$locationsNames = array_map(function($location) { return $location->name; }, $currentGroup->locations->location);
				echo implode(", ", $locationsNames);
				<div class="views-group-subtitle-wrapper" style="padding-top:20px;">CONTACT LEADER</div>
		<div class="views-group-category-wrapper"><i class="fa fa-envelope-o views-category-wrapper" aria-hidden="true"></i><a href="mailto:<?php echo $currentGroup->meeting_city; ?>"><?php echo $currentGroup->meeting_city; ?></a></div>


Login or Signup to post a comment