aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorJames Atkinson <thefinn@users.sourceforge.net>2001-08-17 17:40:37 +0000
committerJames Atkinson <thefinn@users.sourceforge.net>2001-08-17 17:40:37 +0000
commitedd5b78b36fcf91c2abdf6028f30952340316042 (patch)
tree52aabb3d1bf2f833f4799356b5378c82ef73a9a8 /phpBB
parentca10febbbd24f5bc44c5efd9da23aed909e120ea (diff)
downloadforums-edd5b78b36fcf91c2abdf6028f30952340316042.tar
forums-edd5b78b36fcf91c2abdf6028f30952340316042.tar.gz
forums-edd5b78b36fcf91c2abdf6028f30952340316042.tar.bz2
forums-edd5b78b36fcf91c2abdf6028f30952340316042.tar.xz
forums-edd5b78b36fcf91c2abdf6028f30952340316042.zip
Group CP done, except for group moderators removing group members
git-svn-id: file:///svn/phpbb/trunk@899 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/groupcp.php135
-rwxr-xr-xphpBB/language/email/group_approved_english.tpl8
-rwxr-xr-xphpBB/language/lang_english.php6
-rw-r--r--phpBB/templates/PSO/groupcp_user_body.tpl2
4 files changed, 142 insertions, 9 deletions
diff --git a/phpBB/groupcp.php b/phpBB/groupcp.php
index d30576264d..0b350bdccb 100644
--- a/phpBB/groupcp.php
+++ b/phpBB/groupcp.php
@@ -40,17 +40,15 @@ if(!isset($HTTP_GET_VARS['start']))
$start = 0;
}
-//
-// Page header
-//
$page_title = $lang['Group_Control_Panel'];
-include($phpbb_root_path . 'includes/page_header.'.$phpEx);
//
-// What shall we do? hhmmmm
+// First, joining a group
//
if( isset($HTTP_POST_VARS['joingroup']) )
{
+ include($phpbb_root_path . 'includes/page_header.'.$phpEx);
+
// If the user isn't logged in give them an error
if(!$userdata['session_logged_in'])
{
@@ -89,9 +87,80 @@ if( isset($HTTP_POST_VARS['joingroup']) )
message_die(GENERAL_MESSAGE, $lang["Group_joined"], $lang['Subscribe']);
}
+//
+// Second, unsubscribing from a group
+//
+else if( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending']) )
+{
+ //
+ // Check for confirmation of unsub.
+ //
+ $confirm = ($HTTP_POST_VARS['confirm']) ? TRUE : FALSE;
+ $group_id = ( isset($HTTP_POST_VARS[POST_GROUPS_URL]) ) ? $HTTP_POST_VARS[POST_GROUPS_URL] : $HTTP_GET_VARS[POST_GROUPS_URL];
+
+ if($HTTP_POST_VARS['not_confirm'])
+ {
+ header("Location: groupcp.$phpEx");
+ }
+
+ if($confirm)
+ {
+ include($phpbb_root_path . 'includes/page_header.'.$phpEx);
+
+ $sql = "DELETE FROM ".USER_GROUP_TABLE." WHERE user_id = ".$userdata['user_id']." AND group_id = $group_id";
+
+ if(!$result = $db->sql_query($sql))
+ {
+ message_die(GENERAL_ERROR, "Could not delete group memebership data", "Error", __LINE__, __FILE__, $sql);
+ }
+ else
+ {
+ message_die(GENERAL_MESSAGE, $lang['Usub_success'], $lang['Unsubscribe']);
+ }
+
+
+ include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
+ }
+ else
+ {
+ include($phpbb_root_path . 'includes/page_header.'.$phpEx);
+
+ $template->set_filenames(array("confirm" => "confirm_body.tpl"));
+
+ $hidden_fields = '<input type="hidden" name="'.POST_GROUPS_URL.'" value="'.$group_id.'" /><input type="hidden" name="unsub" value="1" />';
+ if(isset($HTTP_POST_VARS['unsub']))
+ {
+ $unsub_msg = $lang['Confirm_unsub'];
+ }
+ else
+ {
+ $unsub_msg = $lang['Confirm_unsub_pending'];
+ }
+ $template->assign_vars(array("MESSAGE_TITLE" => $lang['Confirm'],
+ "MESSAGE_TEXT" => $unsub_msg,
+ "L_YES" => $lang['Yes'],
+ "L_NO" => $lang['No'],
+ "S_CONFIRM_ACTION" => append_sid("groupcp.$phpEx"),
+ "S_HIDDEN_FIELDS" => $hidden_fields));
+ $template->pparse("confirm");
+ include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
+
+ }
+
+
+}
+//
+// Third, everything else
+//
else if( isset($HTTP_GET_VARS[POST_GROUPS_URL]) || isset($HTTP_POST_VARS[POST_GROUPS_URL]) )
{
//
+ // Include page header here because we might need to send a header redirect from the unsub section
+ //
+ include($phpbb_root_path . 'includes/page_header.'.$phpEx);
+ $group_id = ( isset($HTTP_POST_VARS[POST_GROUPS_URL]) ) ? $HTTP_POST_VARS[POST_GROUPS_URL] : $HTTP_GET_VARS[POST_GROUPS_URL];
+
+ //
// Handle approvals and denials
//
if(isset($HTTP_POST_VARS['approve']) || isset($HTTP_POST_VARS['deny']))
@@ -101,6 +170,7 @@ else if( isset($HTTP_GET_VARS[POST_GROUPS_URL]) || isset($HTTP_POST_VARS[POST_GR
if(isset($HTTP_POST_VARS['approve']))
{
+ $sql_select = "SELECT user_email FROM ". USERS_TABLE . " WHERE ";
$sql = "UPDATE ".USER_GROUP_TABLE." SET user_pending = 0 WHERE ";
}
else if(isset($HTTP_POST_VARS['deny']))
@@ -112,21 +182,69 @@ else if( isset($HTTP_GET_VARS[POST_GROUPS_URL]) || isset($HTTP_POST_VARS[POST_GR
{
if($x > 0)
{
+ $sql_select .= " OR ";
$sql .= " OR ";
}
$sql .= "user_id = ".$members[$x];
+ $sql_select .= "user_id = ".$members[$x];
}
- if(!$result = $db->sql_query($sql))
+ if(!$result = $db->sql_query($sql, BEGIN_TRANSACTION))
{
message_die(GENERAL_ERROR, "Could not update user group table.", "Error", __LINE__, __FILE__, $sql);
}
+
+ // Email user when they'er approved
+ if(isset($HTTP_POST_VARS['approve']))
+ {
+ if(!$result = $db->sql_query($sql_select))
+ {
+ message_die(GENERAL_ERROR, "Could not get user email information", "Error", __LINE__, __FILE__, $sql);
+ }
+ $email_rowset = $db->sql_fetchrowset($result);
+ $members_count = $db->sql_numrows($result);
+
+ //
+ // Get the group name
+ //
+ $group_sql = "SELECT group_name FROM ".GROUPS_TABLE." WHERE group_id = $group_id";
+ if(!$result = $db->sql_query($group_sql))
+ {
+ message_die(GENERAL_ERROR, "Could not get group information", "Error", __LINE__, __FILE__, $group_sql);
+ }
+ $group_name_row = $db->sql_fetchrow($result);
+ $group_name = $group_name_row['group_name'];
+
+ $email_headers = "From: " . $board_config['board_email_from'] . "\r\n";
+ $emailer->use_template("group_approved");
+ $emailer->extra_headers($email_headers);
+ $emailer->set_subject($lang['Group_approved']);
+
+ for($x = 0; $x < $members_count; $x++)
+ {
+ if($x > 0)
+ {
+ $email_address .= ", ";
+ }
+ $email_address .= $email_rowset[$x]['user_email'];
+ }
+ $emailer->email_address($email_address);
+ $emailer->assign_vars(array(
+ "SITENAME" => $board_config['sitename'],
+ "U_GROUPCP" => "http://".$SERVER_NAME.$PHP_SELF."?".POST_GROUPS_URL."=$group_id",
+ "GROUP_NAME" => $group_name,
+ "EMAIL_SIG" => $board_config['board_email'])
+ );
+ $emailer->send();
+ $emailer->reset();
+ }
+
+
}
//
// END approve or deny
//
- $group_id = ( isset($HTTP_POST_VARS[POST_GROUPS_URL]) ) ? $HTTP_POST_VARS[POST_GROUPS_URL] : $HTTP_GET_VARS[POST_GROUPS_URL];
$start = ( isset($HTTP_GET_VARS['start']) ) ? $HTTP_GET_VARS['start'] : 0;
@@ -201,7 +319,7 @@ else if( isset($HTTP_GET_VARS[POST_GROUPS_URL]) || isset($HTTP_POST_VARS[POST_GR
else if($is_group_member)
{
$group_details = $lang['Member_this_group'] . " <input type=\"submit\" name=\"unsub\" value=\"" . $lang['Unsubscribe'] . "\" .>";
- $s_hidden_fields = "";
+ $s_hidden_fields = "<input type=\"hidden\" name=\"" . POST_GROUPS_URL . "\" value=\"$group_id\" />";
}
else
{
@@ -504,6 +622,7 @@ else if( isset($HTTP_GET_VARS[POST_GROUPS_URL]) || isset($HTTP_POST_VARS[POST_GR
}
else
{
+ include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$sql = "SELECT group_id, group_name
FROM " . GROUPS_TABLE . "
diff --git a/phpBB/language/email/group_approved_english.tpl b/phpBB/language/email/group_approved_english.tpl
new file mode 100755
index 0000000000..0e5c226fa1
--- /dev/null
+++ b/phpBB/language/email/group_approved_english.tpl
@@ -0,0 +1,8 @@
+Congratulations,
+
+Your request to join the "{GROUP_NAME}" group on {SITENAME} has been approved.
+Click on the following link to see your group membership.
+
+{U_GROUPCP}
+
+{EMAIL_SIG}
diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php
index ec747c78b3..c9cae157b8 100755
--- a/phpBB/language/lang_english.php
+++ b/phpBB/language/lang_english.php
@@ -473,6 +473,12 @@ $lang['No_group_members'] = "This group has no members";
$lang["Group_joined"] = "You have successfully subscribed to this group, you will be notifed when your subscription is approved by the group moderator.";
$lang['Group_request'] = "A request to join your group has been made";
+$lang['Group_approved'] = "Your request has been approved";
+
+$lang['Confirm_unsub'] = "Are you sure you want to unsubscribe from this group?";
+$lang['Confirm_unsub_pending'] = "Are you sure you want to unsubscribe from this group? You subscription has not yet been approved or denied!";
+
+$lang['Usub_success'] = "You have been successfully unsubscribed from this group.";
$lang['Approve_selected'] = "Approve Selected";
$lang['Deny_selected'] = "Deny Selected";
diff --git a/phpBB/templates/PSO/groupcp_user_body.tpl b/phpBB/templates/PSO/groupcp_user_body.tpl
index 8f33805823..a959e7e94f 100644
--- a/phpBB/templates/PSO/groupcp_user_body.tpl
+++ b/phpBB/templates/PSO/groupcp_user_body.tpl
@@ -18,7 +18,7 @@
<tr><form method="post" action="{S_USERGROUP_ACTION}">
<td width="40%" align="center">&nbsp;{GROUP_MEMBER_SELECT}&nbsp;</td>
<td width="30%" align="center">&nbsp;<input type="submit" name="viewinfo" value="{L_VIEW_INFORMATION}">&nbsp;</td>
- <td width="30%" align="center">&nbsp;<input type="submit" name="unsubjoin" value="{L_UNSUBSCRIBE}">&nbsp;</td>
+ <td width="30%" align="center">&nbsp;<input type="submit" name="unsub" value="{L_UNSUBSCRIBE}">&nbsp;</td>
</form></tr>
</table></td>
</tr>