$group_obj = new SocialGroup($gid); /** If public * allow anyone to join the group without approval */ if ($group_obj->getPrivacy() == 0) { /*public*/ $result = $group_obj->addMember($_SESSION['member_id']); //adding "myself" into the group if ($result) { $msg->addFeedback('GROUP_JOINED'); } else { $msg->addError('JOIN_REQUEST_FAILED'); } } else { /*private*/ $result = $group_obj->addRequest(); if ($result) { $sql = "SELECT member_id from " . TABLE_PREFIX . "social_groups WHERE id = '{$gid}'"; $result_sender = mysql_query($sql, $db); $grpadmins = mysql_fetch_row($result_sender); $grpadmin = $grpadmins['0']; require AT_INCLUDE_PATH . 'classes/phpmailer/atutormailer.class.php'; $sql_notify = "SELECT first_name, last_name, email FROM " . TABLE_PREFIX . "members WHERE member_id={$grpadmin}"; $result_notify = mysql_query($sql_notify, $db); $row_notify = mysql_fetch_assoc($result_notify); if ($row_notify['email'] != '') { $body = _AT('notification_group_request', $group_obj->getName(), $_base_href . AT_SOCIAL_BASENAME . 'index_mystart.php'); $sender = get_display_name($_SESSION['member_id']); $mail = new ATutorMailer(); $mail->AddAddress($row_notify['email'], $sender); $mail->FromName = $_config['site_name'];