-
-
Save ademers/4dbb6e7237ea7b4265f2a6d72397fc24 to your computer and use it in GitHub Desktop.
ExpressionEngine PHP Export into JSON: Members by group
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$group = $_GET['id']; | |
$content = array(); | |
$entries_query = $this->EE->db->query("SELECT * FROM exp_members WHERE exp_members.group_id = '$group'"); | |
foreach ($entries_query->result_array() as $id => $row) { | |
$content[$id] = array(); | |
// Remove spaces from EE usernames | |
$content[$id]['username'] = str_replace(' ', '', $row['username']); | |
$content[$id]['email'] = $row['email']; | |
$content[$id]['join_date'] = ($row['join_date']) ? date('Y-m-d H:i:s', $row['join_date']) : ''; | |
$content[$id]['member_id'] = $row['member_id']; | |
$content[$id]['group_id'] = $row['group_id']; | |
} | |
echo json_encode($content); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For anybody else that finds this. If you want some of the member profile data along just the member data then you can adapt it like this. Example used is an
occupation
field in EE member profile