Feature #182

Recently Update Groups

Added by Webwind Webwind over 7 years ago. Updated almost 4 years ago.

Status:ClosedStart date:09/14/2010
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:vShare 2.9

History

#1 Updated by Webwind Webwind over 7 years ago

ALTER TABLE `groups` ADD `group_last_update` varchar(20) NOT NULL

groups.php

else if ($category == 'videos')
{
$sql = "SELECT DISTINCT *,count(group_video_video_id) AS `total` FROM
`group_videos` AS gv,
`groups` AS g WHERE
gv.group_video_group_id=g.group_id
GROUP BY gv.group_video_group_id
ORDER BY `total` DESC";
$rows = 1;
$category_tpl = 'Most Videos';
}
else if ($category == 'updated') {
$sql = "SELECT count(*) AS `total` FROM `groups`";
$rows = 0;
$category_tpl = 'Recently Updated Groups';
}

else if ($category == 'videos')
{
$sql = "SELECT DISTINCT *,count(gv.group_video_video_id) AS `total` FROM
`group_videos` AS gv,
`groups` AS g WHERE
gv.group_video_group_id=g.group_id
GROUP BY gv.group_video_group_id
ORDER BY `total` DESC
LIMIT $start_from, $config[items_per_page]";
}
else if ($category == 'updated') {
$sql = "SELECT * FROM `groups`
ORDER BY `group_last_update` DESC
LIMIT $start_from, $config[items_per_page]";
}

groups.tpl

Updated {insert name=time_range assign=last_update field=group_last_update IDFR=group_id id=$group_info[i].group_id tbl=groups}{$last_update}


funcions_insert.php - find the -> insert_time_range

$field_arr = array(
'video_add_time',
'user_last_login_time',
'user_join_time',
'comment_add_time',
'group_create_time',
'group_last_update',
);

-----------------------------------------------------------
group_edit.php

if ($err == '')
{
$sql = "UPDATE `groups` SET
`group_name`= '" . mysql_clean($_POST['group_name']) . "',
`group_keyword`= '" . mysql_clean($_POST['group_keyword']) . "',
`group_description`= '" . mysql_clean($_POST['group_description']) . "',
`group_type`= '" . mysql_clean($_POST['group_type']) . "',
`group_upload`= '" . mysql_clean($_POST['group_upload']) . "',
`group_last_update`='" . mysql_clean($_SERVER['REQUEST_TIME']) . "',
`group_image`= '" . mysql_clean($_POST['group_image']) . "' WHERE
`group_owner_id`='" . (int) $_SESSION['UID'] . "' AND
`group_url`='" . mysql_clean($_GET['group_url']) . "'";
mysql_query($sql) or mysql_die($sql);
}

group_add_videos.php

for ($i = 0;$i < count($_POST['add_videos']);$i++) {
$sql = "INSERT INTO `group_videos` SET
`group_video_group_id`='" . (int) $group_info['group_id'] . "',
`group_video_video_id`='" . (int) $_POST['add_videos'][$i] . "',
`group_video_member_id`='" . (int) $_SESSION['UID'] . "',
`group_video_approved`='" . mysql_clean($approved) . "'";
mysql_query($sql) or mysql_die($sql);

$sql = "UPDATE `groups` SET
`group_last_update`='" . mysql_clean($_SERVER['REQUEST_TIME']) . "' WHERE
`group_url`='" . mysql_clean($_GET['group_url']) . "'";
mysql_query($sql) or mysql_die($sql);
}

group_join.php

if (mysql_num_rows($result) > 0)
{
$group_member_info = mysql_fetch_assoc($result); {
$sql = "UPDATE `groups` SET
`group_last_update`='" . mysql_clean($_SERVER['REQUEST_TIME']) . "' WHERE
`group_id`='" . mysql_clean($_GET['group_id']) . "'";
mysql_query($sql) or mysql_die($sql);
$sql = "INSERT INTO `group_members` SET
`group_member_group_id`='" . (int) $group_info['group_id'] . "',
`group_member_user_id`='" . (int) $_SESSION['UID'] . "',
`group_member_since`='" . date("Y-m-d H:i:s") . "',
`group_member_approved`='" . mysql_clean($approved) . "'";
mysql_query($sql) or mysql_die($sql);
if ($group_info['group_type'] == 'protected')
{
$msg = $lang['group_membership_requested'];
}
else {
$msg = $lang['group_join_ok'];
}
}
}

if ($_GET['action'] == 'remove') {
$sql = "DELETE FROM `group_members` WHERE
`group_member_group_id`='" . (int) $group_info['group_id'] . "' AND
`group_member_user_id`='" . (int) $_SESSION['UID'] . "'";
$result = mysql_query($sql) or mysql_die($sql);
$msg = $lang['group_membership_revoked'];

$sql = "UPDATE `groups` SET
`group_last_update`='" . mysql_clean($_SERVER['REQUEST_TIME']) . "' WHERE
`group_id`='" . mysql_clean($_GET['group_id']) . "'";
mysql_query($sql) or mysql_die($sql);

}

Thats all

#2 Updated by Webwind Webwind over 7 years ago

and add

header.tpl

<a href="{$base_url}/groups/updated/1">Recently Updated</a>

#3 Updated by BuyScripts Admin about 4 years ago

  • Target version set to vShare 2.9

#4 Updated by BuyScripts Admin about 4 years ago

  • Assignee set to Suneesh PM

#5 Updated by BuyScripts Admin almost 4 years ago

  • Assignee deleted (Suneesh PM)

#6 Updated by BuyScripts Admin almost 4 years ago

  • Status changed from New to Closed

Also available in: Atom PDF