From 1919da0f9ca3f6b7050f010f1ba9041a4f86da1e Mon Sep 17 00:00:00 2001 From: Steve Bourgeois Date: Wed, 19 Jul 2017 07:28:36 -0400 Subject: [PATCH] Added A Function that Allows the Retreival of the GroupID By Name --- include/Messaging.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/include/Messaging.php b/include/Messaging.php index b40faf6..4f86e30 100644 --- a/include/Messaging.php +++ b/include/Messaging.php @@ -30,6 +30,33 @@ public function GetAll() return $data; } + + /** + * Get the GroupID (threadId) by the Group Name + * + * @param string $sGroupName Name of Group you are searching for within your Groups + * @throws + * @return string $sThreadId GroupID or null if not found + */ + + public function GetGroupIdByName($sGroupName) + { + $oAllgroups = $this->GetAll(); + + $sThreadId = null; + + foreach( $oAllgroups->threads as $iKey => $aGroupDetails) + { + if ($aGroupDetails->threadNameDetail->threadName == trim($sGroupName)) + { + $sThreadId = $aGroupDetails->threadId; + break; + } + + } + return $sThreadId; + } + // Get Favorite Groups public function GetFavorites() {