• My have an event driven site and some of our events are hosted on meetup.com as well. I currently have the attendee list from meetup being merged with the attendee list on my site.

    The issue is my RSVP will appear twice since I am on both lists. When the meetup list is being added to my site, I would like to prevent my information from being displayed based on adding that ID to a custom field in my event.

    Any help would be greatly appreciated. My code is as follows:

    /* load Meetup attendees - code starts here */
    	$MEETUP_API_KEY = "b3d07b1b40124b62694a16255445b";		/* UPDATE WITH YOUR MEETUP API KEY */
    	$ar_MeetupId = get_post_custom_values("Meetup ID");				// fetch the Meetup ID attribute values
    	$meetupId = $ar_MeetupId[0];
    
    if($meetupId!='') {			//	 if a Meetup Id is assigned to the event load attendees from Meetup.com
    		$URL = "https://api.meetup.com/2/rsvps?&sign=true&event_id=" . $meetupId . "&key=" . $MEETUP_API_KEY;
    		$cURL = curl_init();
    		curl_setopt($cURL, CURLOPT_URL, $URL);
    		curl_setopt($cURL, CURLOPT_RETURNTRANSFER, 1);
    		curl_setopt($cURL, CURLOPT_SSL_VERIFYPEER, 0);
    		$json_string = curl_exec($cURL);
    		$response = json_decode($json_string, true);
    		$count = $response['meta']['total_count'];		// find total count of attendees
    
    		for($i=0;$i<count($response['results']);$i++) {
    			$is_attending = $response['results'][$i]['response'];
    			if(strtolower($is_attending) == 'yes') {		// only display attendees who have accepted to attend the event
    
    				if($response['results'][$i]['member_photo']['thumb_link']!='')			// if a thumbnail image is available display it in 50x50
    					echo '<div style="width:16em; float:left;"><div class="avatar"><div style="float:left; width:5em; height:5em;"><img src="' . $response['results'][$i]['member_photo']['thumb_link'] . '" width="3.75em" height="3.75em" style="width:3.75em;height:3.75em;"></div></div>';
    				else
    					echo '<div style="width:4em; float:left;"><img src="/nophoto.jpg" width="3.75em" height="3.75em" style="width:3.75em;height:3.75em;"></div>';
    
    				echo '<div style="width:11em; float:left;"><h6>'. $response['results'][$i]['member']['name'] .'</h6></div>';
    
    				echo '<div style="width:2em; float:left;"><h6>(' . ($response['results'][$i]['guests'] + 1) . ')</h6></div>';
    
    				echo '<div style="width:10em; float:left;">&nbsp;</div></div>';
    
    			}
    		}
    	}
    	/* load Meetup attendees - code ends here */
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    If the duplicate values are exact duplicates, use the array_unique() function to remove them. If the match criteria is more elaborate, you can use various array sort and string compare functions to identify duplicates then use unset() to remove the duplicate array element.

Viewing 1 replies (of 1 total)

The topic ‘Remove specific key from array’ is closed to new replies.