/**
 * Edit the base details for a group.
 *
 * These are the settings that appear on the first page of the group's Admin
 * section (Name, Description, and "Notify members...").
 *
 * @param int    $group_id       ID of the group.
 * @param string $group_name     Name of the group.
 * @param string $group_desc     Description of the group.
 * @param bool   $notify_members Whether to send an email notification to group
 *                               members about changes in these details.
 *
 * @return bool True on success, false on failure.
 */
function groups_edit_base_group_details($group_id, $group_name, $group_desc, $notify_members)
{
    if (empty($group_name) || empty($group_desc)) {
        return false;
    }
    $group = groups_get_group(array('group_id' => $group_id));
    $old_group = clone $group;
    $group->name = $group_name;
    $group->description = $group_desc;
    if (!$group->save()) {
        return false;
    }
    if ($notify_members) {
        groups_notification_group_updated($group->id, $old_group);
    }
    /**
     * Fired after a group's details are updated.
     *
     * @since 2.2.0
     *
     * @param int             $value          ID of the group.
     * @param BP_Groups_Group $old_group      Group object, before being modified.
     * @param bool            $notify_members Whether to send an email notification to members about the change.
     */
    do_action('groups_details_updated', $group->id, $old_group, $notify_members);
    return true;
}
function groups_edit_base_group_details($group_id, $group_name, $group_desc, $notify_members)
{
    if (empty($group_name) || empty($group_desc)) {
        return false;
    }
    $group = groups_get_group(array('group_id' => $group_id));
    $group->name = $group_name;
    $group->description = $group_desc;
    if (!$group->save()) {
        return false;
    }
    if ($notify_members) {
        groups_notification_group_updated($group->id);
    }
    do_action('groups_details_updated', $group->id);
    return true;
}
Example #3
0
function groups_edit_base_group_details( $group_id, $group_name, $group_desc, $notify_members ) {
	global $bp;

	if ( empty( $group_name ) || empty( $group_desc ) )
		return false;

	$group = new BP_Groups_Group( $group_id );
	$group->name = $group_name;
	$group->description = $group_desc;

	if ( !$group->save() )
		return false;

	if ( $notify_members ) {
		require_once ( BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php' );
		groups_notification_group_updated( $group->id );
	}

	do_action( 'groups_details_updated', $group->id );

	return true;
}
 function map_bp_group_info($bp_group, $fb_group, $token = false)
 {
     if (!function_exists('groups_edit_base_group_details')) {
         return false;
     }
     $data = false;
     //$access_token = $token ? "?access_token={$token}" : "";
     if ($token) {
         $old_token = $this->fb->getAccessToken();
         $this->fb->setAccessToken($token);
     }
     try {
         $data = $this->fb->api("/{$fb_group}/");
     } catch (Exception $e) {
     }
     if ($token) {
         $this->fb->setAccessToken($old_token);
     }
     if (!$data) {
         return false;
     }
     $group = groups_get_group(array('group_id' => $bp_group));
     if (!$group) {
         return false;
     }
     // Privacy settings
     if ($this->data->get_option('wdfb_groups', 'allow_group_privacy_sync')) {
         $status = !empty($data['privacy']) ? $data['privacy'] : $group->status;
         if ('OPEN' == $status) {
             $status = 'public';
         }
         if ('CLOSED' == $status) {
             $status = 'private';
         }
         if ('SECRET' == $status) {
             $status = 'hidden';
         }
         $group->status = $status;
     }
     $group->name = !empty($data['name']) ? $data['name'] : $group->name;
     $group->description = !empty($data['description']) ? $data['description'] : $group->description;
     $group->save();
     if ($this->data->get_option('wdfb_groups', 'notify_members')) {
         groups_notification_group_updated($group->id);
     }
 }
Example #5
0
function groups_edit_base_group_details($group_id, $group_name, $group_desc, $group_news, $notify_members)
{
    global $bp;
    /* Check the nonce first. */
    if (!check_admin_referer('groups_edit_group_details')) {
        return false;
    }
    if (empty($group_name) || empty($group_desc)) {
        return false;
    }
    $group = new BP_Groups_Group($group_id, false, false);
    $group->name = $group_name;
    $group->description = $group_desc;
    $group->news = $group_news;
    if (!$group->save()) {
        return false;
    }
    if ($notify_members) {
        require_once BP_PLUGIN_DIR . '/bp-groups/bp-groups-notifications.php';
        groups_notification_group_updated($group->id);
    }
    do_action('groups_details_updated', $group->id);
    return true;
}