If anyone is interesting in NewsFeed MOD, here is something that I made. It will show you lates updates from you friends:
- update when you friend has uploaded image
- update when you friend has post a comment
If you want to use this mod, you'll need to install [MOD] Buddy List || Friend List from ccsakuweb:
http://www.4homepages.de/forum/index.php?topic=17491.0Create file
newsfeed.php<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: newsfeed.php *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.6 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (Lizenz.txt) für weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (Licence.txt) for further information. *
* *
*************************************************************************/
$main_template = 'newsfeed';
define('GET_CACHES', 1);
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/page_header.php');
$sql_friends = "SELECT *
FROM ".USERS_TABLE."
WHERE user_id = ".$user_info['user_id']."";
$friends_row = $site_db->query_firstrow($sql_friends);
// CHECK IF USER HAS FRIENDS / [MOD] Buddy List || Friend List (ccsakuweb) http://www.4homepages.de/forum/index.php?topic=17491.0
if (!empty($friends_row['user_friend_ids'])) {
$split_keywords = explode(" ", $friends_row['user_friend_ids']);
foreach ($split_keywords as $key => $val) {
$sql1 = "SELECT *
FROM ".USERS_TABLE."
WHERE user_id = $val
ORDER BY user_name ASC";
$friends_name = $site_db->query_firstrow($sql1);
$fname = $friends_name['user_id'];
// USER HAS PUBLISHED PHOTO
$sql_image = "SELECT i.image_id, i.image_date, i.user_id, i.image_name, u.user_id, u.user_name FROM ".IMAGES_TABLE." i, ".USERS_TABLE." u WHERE u.user_id = i.user_id AND i.user_id = $fname AND i.image_date > UNIX_TIMESTAMP() - $time";
$image_row = $site_db->query_firstrow($sql_image);
if (!empty($image_row)) {
$image_date = format_date($config['date_format']." ".$config['time_format'],$image_row['image_date']);
$newsfeed .= "<div style=\"padding: 2px\"> <strong><a href=\"/member.php?action=showprofile&user_id=".$image_row['user_id']."\" class=\"nickname\" >".$image_row['user_name']."</a></strong> has published photo <strong><a href=\"/details.php?image_id=".$image_row['image_id']."\">".$image_row['image_name']."</a></strong>. Date: <strong>$image_date.</strong></div>";
}
// USER HAS COMMENTED PHOTO
$sql_comment = "SELECT c.user_id, c.comment_text, c.user_name, c.image_id, c.comment_date, i.image_id, i.image_name FROM ".COMMENTS_TABLE." c, ".USERS_TABLE." i WHERE c.image_id = i.image_id AND c.user_id = $fname AND c.comment_date > UNIX_TIMESTAMP() - $time ORDER BY c.comment_date DESC";
$result = $site_db->query($sql_comment);
while($comment_row = mysql_fetch_array($result)){
if (!empty($comment_row)) {
$doit = $comment_row['comment_text'];
$max= 70; //NUMBER OF LETTERS TO SHOW
$modstr1=((strlen($doit)>$max)?substr($doit,0,$max) . "..." : $doit);
$comment_date = format_date($config['date_format']." ".$config['time_format'],$comment_row['comment_date']);
$newsfeed .= "<div style=\"padding: 2px\"> <strong><a href=\"/member.php?action=showprofile&user_id=".$comment_row['user_id']."\">".$comment_row['user_name']."</a></strong> has commented image <strong><a href=\"/details.php?image_id=".$comment_row['image_id'].".html\">".$comment_row['image_name']."</a></strong>.<br><span style=\"padding-left: 20px;font-size: .85em;color: #939393;\">$comment_date</span><br />".$comment_row['comment_text']."</div>";
}
}
}
$site_template->register_vars(array(
"msg" => $msg,
"newsfeed" => $newsfeed
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>
Create new template newsfeed.html and insert this code:
{header}
<table width="640" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<table width="640" border="0" cellspacing="0" cellpadding="0" class="tablehead">
<tr>
<td colspan="4"><img src="{template_url}/images/header_top.gif" width="640" height="6" alt="" /></td>
</tr>
<tr>
<td width="6"><img src="{template_url}/images/header_left.gif" width="6" height="60" alt="" /></td>
<td width="405"><img src="{template_url}/images/header_logo.gif" width="405" height="60" alt="" /></td>
<td width="225" align="right">
<form method="post" action="{url_search}">
<table border="0" cellspacing="0" cellpadding="1">
<tr>
<td>
<input type="text" name="search_keywords" size="15" class="searchinput" />
</td>
<td>
<input type="submit" value="{lang_search}" class="button" name="submit" />
</td>
</tr>
<tr valign="top">
<td colspan="2"><a href="{url_search}" class="smalltext">{lang_advanced_search}</a></td>
</tr>
</table>
</form>
</td>
<td align="right" width="6"><img src="{template_url}/images/header_right.gif" width="6" height="60" alt="" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="bordercolor">
<table width="640" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="tablebgcolor">
<table width="638" border="0" cellspacing="1" cellpadding="0">
<tr>
<td class="navbar" height="23">
<table width="636" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</td>
<td align="right">
<a href="{url_top_images}"><b>{lang_top_images}</b></a>
<a href="{url_new_images}"><b>{lang_new_images}</b></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="638" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" class="row2" valign="top">
<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head2" height="20"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_registered_user}</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<tr>
<td align="center" class="row1">{user_box}</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
</table>
{if random_image}
<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<tr>
<td align="center" class="row1">
<br />
{random_image}
<br />
<br />
</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
</table>
{endif random_image}
</td>
<td width="1" class="bordercolor" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
<td width="18" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="18" height="18" /></td>
<td width="450" valign="top">
<br />
<span class="title">{lang_control_panel}</span>
<hr size="1" />
{if msg}<b>{msg}</b><br /><br />
{endif msg}
{newsfeed}
<p> </p>
</td>
<td width="19" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="19" height="19" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="640" border="0" cellspacing="0" cellpadding="0" class="tablebottom">
<tr>
<td width="6"><img src="{template_url}/images/footer_left.gif" width="6" height="19" alt="" /></td>
<td width="405"> </td>
<td width="225"> </td>
<td width="6"><img src="{template_url}/images/footer_right.gif" width="6" height="19" alt="" /></td>
</tr>
</table>
</td>
</tr>
</table>
{footer}
I suggest you to test this MOD first before you make it public, because I'm not sure how will work in you gallery.
There is one problem, I don't know how could I sort all feed by date. Does anyone has any idea?