rayhova 0 Newbie Poster

First off I want to apologize for any confusion as I'm not a programmer, so what I say, and am trying to convey, may come across as backwards or excessive. So I apologize for my ignorance.
Somehow though, I manage to lumber my way through these scripts.. lol
PHP Code (Issue with itme 43)

<?php


class Friends_feeds extends DB{
    
function newsfeed(){

/*
Function getFeedTime()
Returns the feed time limit in seconds
*/
function getFeedTime() {
    
    // get time limit in days from database
    $timeQuery = mysql_query("SELECT value from feed_config WHERE id=1");
    $timeResults = mysql_fetch_array($timeQuery);
    
    // calculate the time in seconds
    $timeSeconds = $timeResults['value'] * 86400;
    
    return $timeSeconds;
}

//get sections from feed_config - for the admin section
function getSections() {
    
    $sectionsArray = array();
    $sectionsQuery = mysql_query("SELECT id,name,value from feed_config WHERE id != 1 AND id != 46 ORDER BY position ASC");
    while ($tRow = mysql_fetch_array($sectionsQuery)) {
        $name = strtolower($tRow['name']);
        $sectionsArray[$name] = $tRow['value'];
    }
    
    return $sectionsArray;
}

//not used in this release
function getFeedItems() {
    
    $itemsResults = mysql_fetch_array(mysql_query("SELECT value from feed_config WHERE id = 46"));
    return $itemsResults['value'];
}


// function to sort the array by time
function mysort($a,$b) {
    return $b['time'] - $a['time'];
}    
    
    // get feed time as set in admin, then calculate minimum time
    $fTime = getFeedTime();
    $feedTime = time() - $fTime;
    
    // load array of admin section permissions
    $sectionsArray = getSections();
    
    // array to store the newsfeed
    $newsfeed = array();
    
    $info = $GLOBALS["Member"]->info();
    $per_id = $GLOBALS["Get"]->type_val("per_id","integer");
    
    if(empty($per_id)){
        $per_id = extract_id("mem_id","profiles");
    }//if
    
    if(empty($per_id)){
        $per_id = $info["mem_id"];
    }//if
    
    $cache = $GLOBALS["Network"]->get_cache($per_id);
    
    $sql_query = "SELECT mem_id FROM members WHERE ".$GLOBALS["Network"]->extract_hs_query($cache["friends"])."
                  ";    
    $result = $GLOBALS["DB"]->result($sql_query);
    
    
    $friends = array();
        foreach($result as $res){
        
        
        //Profile Updated////////////////
        if ($sectionsArray['profile_updated'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery); 
        if ($row['profile_updated'] == 1) {         
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery); 
         if ($row['profile_updated'] == 1) {
         
            $profile_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small, p.updated 
                               FROM members as m, profiles as p
                              WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND p.updated > $feedTime ORDER BY p.updated DESC" ;
                              
                $result = mysql_query($profile_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['updated']), "gender" => $row['gender'], "photo_small" => $row["photo_small"], "fname" => $row["fname"], "folder" => $row['folder'],"type" => 1 );
            }
         }
        }
        }
                
//Profile Updated End///////////

//Photos Uploaded//////////////
        if ($sectionsArray['photos_uploaded'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['photos_uploaded'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['photos_uploaded'] == 1) {
         
            $photos_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small as p2, p.updated, ph.pho_id, ph.mem_id, ph.photo_small, ph.photo_med, ph.photo, ph.posted 
                              FROM members as m, profiles as p, photos as ph
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = ph.mem_id AND ph.posted > $feedTime ORDER BY ph.posted DESC" ;
                              
                $result = mysql_query($photos_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "fname" => $row["fname"], "folder" => $row['folder'], "photo_p2" => $row["p2"], "photo_small" => $row["photo_small"], "photo_med" => $row["photo_med"], "photo" => $row["photo"], "photo_id" => $row["pho_id"], "per_id" => $per_id, "type" => 2 );
            }
         }
        }
        }
//Photos Uploaded End///////////

//Blog Created//////////////////
        if ($sectionsArray['blog_created'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['blog_created'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['blog_created'] == 1) {
         
            $blogs_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder as pf, p.gender, p.photo_small, b.mem_id, b.blg_id, b.title, b.folder, b.posted 
                              FROM members as m, profiles as p, blogs as b
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = b.mem_id AND b.posted > $feedTime ORDER BY b.posted DESC" ;
                              
                $result = mysql_query($blogs_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "fname" => $row["fname"], "photo_small" => $row["photo_small"], "blg_id" => $row["blg_id"], "title" => $row["title"], "folder" => $row["folder"], "pf" => $row['pf'], "type" => 3 );
            }
         }
        }
        }
//Blog Created End///////////////

//Blog Add Post//////////////////
        if ($sectionsArray['blog_post'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['blog_post'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['blog_post'] == 1) {

            $blogs_add_post_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder as pf, p.gender, p.photo_small, b.mem_id, b.blg_id, b.title as t1, b.folder, bp.blg_id, bp.pst_id, bp.title as t2, bp.posted
                              FROM members as m, profiles as p, blogs as b, blogs_posts as bp
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = b.mem_id AND b.blg_id = bp.blg_id AND bp.posted > $feedTime ORDER BY bp.posted DESC" ;
                              
                $result = mysql_query($blogs_add_post_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "fname" => $row["fname"], "photo_small" => $row["photo_small"], "blg_id" => $row["blg_id"], "pst_id" => $row["pst_id"], "title_blog" => $row["t1"], "title_post" => $row["t2"], "folder" => $row["folder"], "pf" => $row['pf'], "type" => 5 );
            }
         }
        }
        }
//Blog Add Post End//////////////

//Blog Comment//////////////////
        if ($sectionsArray['blog_comment'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['blog_comment'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['blog_comment'] == 1) {
         
            $blogs_comment_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder as pf, p.gender, p.photo_small, b.mem_id, b.blg_id, b.title as t1, b.folder, bp.blg_id, bp.pst_id, bp.title as t2, bc.blg_id, bc.pst_id, bc.comment, bc.posted
                              FROM members as m, profiles as p, blogs as b, blogs_posts as bp, blogs_comments as bc
                             WHERE ".$res["mem_id"]." = m.mem_id AND ".$res["mem_id"]." = p.mem_id AND ".$res["mem_id"]." = bc.mem_id AND b.blg_id = bp.blg_id AND bp.pst_id = bc.pst_id AND bc.posted > $feedTime ORDER BY bc.posted DESC" ;
                              
                $result = mysql_query($blogs_comment_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "fname" => $row["fname"], "photo_small" => $row["photo_small"], "blg_id" => $row["blg_id"], "pst_id" => $row["pst_id"], "title_blog" => $row["t1"], "title_post" => $row["t2"], "comment" => $row["comment"], "folder" => $row["folder"], "pf" => $row['pf'], "type" => 6 );
            }
         }
        }
        }
//Blog Comment End//////////////

//Classfied Post////////////////
        if ($sectionsArray['classified_post'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['classified_post'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['classified_post'] == 1) {
            
            $classified_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder as pf, p.gender, p.photo_small, p.updated, c.cls_id, c.mem_id, c.title, c.folder, c.posted 
                              FROM members as m, profiles as p, classifieds as c
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = c.mem_id AND c.posted > $feedTime ORDER BY c.posted DESC" ;
                              
                $result = mysql_query($classified_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "fname" => $row["fname"], "photo_small" => $row["photo_small"], "cls_id" => $row["cls_id"], "title" => $row["title"], "folder" => $row["folder"], "pf" => $row['pf'], "type" => 7 );
            }
         }
        }
        }
//Classified Post End//////////

//Club Create//////////////////
        if ($sectionsArray['club_create'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['club_create'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['club_create'] == 1) {
            
            $club_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder as pf, p.gender, p.photo_small, p.updated, c.clb_id, c.mem_id, c.name, c.folder, c.created 
                              FROM members as m, profiles as p, clubs as c
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = c.mem_id AND c.created > $feedTime ORDER BY c.created DESC" ;
                              
                $result = mysql_query($club_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['created']), "fname" => $row["fname"], "photo_small" => $row["photo_small"], "clb_id" => $row["clb_id"], "title" => $row["name"], "folder" => $row["folder"], "pf" => $row['pf'],"type" => 8 );
            }
         }
        }
        }
//Club Create End//////////////

//Event Create//////////////////
        if ($sectionsArray['event_create'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['event_create'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['event_create'] == 1) {
            
            $event_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder as pf, p.gender, p.photo_small, p.updated, e.evn_id, e.mem_id, e.title, e.folder, e.posted 
                              FROM members as m, profiles as p, events as e
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = e.mem_id AND e.posted > $feedTime ORDER BY e.posted DESC" ;
                              
                $result = mysql_query($event_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "fname" => $row["fname"], "photo_small" => $row["photo_small"], "evn_id" => $row["evn_id"], "title" => $row["title"], "folder" => $row["folder"], "pf" => $row['pf'], "type" => 9 );
            }
         }
        }
        }
//Event Create End////////////////

//Forum Post//////////////////////
        if ($sectionsArray['forum_post'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['forum_post'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['forum_post'] == 1) {
            
            $forum_post_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small, f.frm_id, f.title, t.top_id, t.frm_id, t.mem_id, t.subject, t.created 
                              FROM members as m, profiles as p, forums as f, topics as t
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = t.mem_id AND t.frm_id = f.frm_id AND t.created > $feedTime ORDER BY t.created DESC" ;
                              
                $result = mysql_query($forum_post_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['created']), "fname" => $row["fname"], "photo_small" => $row["photo_small"], "frm_id" => $row["frm_id"], "top_id" => $row["top_id"], "title" => $row["title"], "subject" => $row["subject"], "folder" => $row["folder"], "type" => 10 );
            }
         }
        }
        }
//Forum Post End//////////////////

//Song Uploaded///////////////////
        if ($sectionsArray['song_uploaded'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['song_uploaded'] == 1) {
         
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['song_uploaded'] == 1) {
         
            $song_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small, p.updated, ms.mem_id, ms.mus_id, ms.title, ms.artist, ms.posted 
                              FROM members as m, profiles as p, music as ms
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = ms.mem_id AND ms.posted > $feedTime ORDER BY ms.posted DESC" ;
                              
                $result = mysql_query($song_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "fname" => $row["fname"], "photo_small" => $row["photo_small"], "mus_id" => $row["mus_id"], "title" => $row["title"], "artist" => $row["artist"], "folder" => $row['folder'], "type" => 11 );
            }
         }
        }
        }
//Song Uploaded End//////////////////

//Video Uploaded/////////////////////
        if ($sectionsArray['video_uploaded'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['video_uploaded'] == 1) {        
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['video_uploaded'] == 1) {                                            
            
            $video_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small, p.updated, v.mem_id, v.vid_id, v.title, v.shash, v.posted 
                              FROM members as m, profiles as p, videos as v
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = v.mem_id AND v.posted > $feedTime ORDER BY v.posted DESC" ;
                              
                $result = mysql_query($video_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "fname" => $row["fname"], "photo_small" => $row["photo_small"], "vid_id" => $row["vid_id"], "title" => $row["title"], "shash" => $row["shash"], "folder" => $row['folder'], "type" => 12 );
            }
         }
        }
        }
//Video Uploaded End////////////////    

//New Friends/////////////////////
        if ($sectionsArray['new_friends'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['new_friends'] == 1) {        
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['new_friends'] == 1) {                    
         
            $friends_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small, p.updated, f.mem_id, f.per_id, f.posted
                              FROM members as m, profiles as p, friends as f
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = f.mem_id AND f.posted > $feedTime ORDER BY f.posted DESC" ;          
                $result = mysql_query($friends_query) or die('Error: '.mysql_error());
                while($me = mysql_fetch_array($result)){
                
                $friend_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder as folder2, p.gender, p.updated
                              FROM members as m, profiles as p
                             WHERE m.mem_id = ".$me['per_id']." AND p.mem_id = ".$me['per_id']."" ;
                $friend_result = mysql_query($friend_query) or die('Error: '.mysql_error());
                while($friend = mysql_fetch_array($friend_result)){        
                
                $newsfeed[] = array("time" => ($me['posted']), "fname1" => $me["fname"], "fname2" => $friend["fname"], "folder1" => $me["folder"], "folder2" => $friend["folder2"], "photo_small" => $me["photo_small"], "mem_id1" => $res["mem_id"], "mem_id2" => $me["mem_id"], "mem_id3" => $friend["mem_id"], "type" => 15 );
            }
            }
         }
         }
        }
//New Friends End/////////////////

//New Polls///////////////////////
        if ($sectionsArray['poll_created'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);
        if ($row['poll_created'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);
         if ($row['poll_created'] == 1) {    

            $poll_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small, p.updated, pl.mem_id, pl.pol_id, pl.question, pl.created
                              FROM members as m, profiles as p, polls as pl
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = pl.mem_id AND pl.approved = '1' AND pl.created > $feedTime ORDER BY pl.created DESC" ;
                              
                $result = mysql_query($poll_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['created']), "fname" => $row["fname"], "photo_small" => $row["photo_small"], "pol_id" => $row["pol_id"], "question" => $row["question"], "folder" => $row["folder"], "type" => 16 );
            }
         }
        }
        }
//New Polls End/////////////////////    

//New Bulletins/////////////////////
        if ($sectionsArray['bulletin_created'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);
        if ($row['bulletin_created'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);
         if ($row['bulletin_created'] == 1) {    

            $bulletin_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small, p.updated, b.mem_id, b.bul_id, b.subject, b.date
                              FROM members as m, profiles as p, bulletins as b
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = b.mem_id AND b.date > $feedTime ORDER BY b.date DESC" ;
                              
                $result = mysql_query($bulletin_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['date']), "fname" => $row["fname"], "photo_small" => $row["photo_small"], "bul_id" => $row["bul_id"], "subject" => $row["subject"], "folder" => $row["folder"], "type" => 17 );
            }
         }
         }
         }
//New Bulletins End/////////////////
//Club Photos//////////////////////
        if ($sectionsArray['club_photo'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);
        if ($row['club_photo'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);
         if ($row['club_photo'] == 1) {

            $club_photo_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder as pfolder, p.gender, p.photo_small as p2, p.updated, c.mem_id, c.clb_id as clb1, c.name, c.folder as cfolder, cp.pho_id, cp.mem_id, cp.clb_id as clb2, cp.photo_small, cp.photo_med, cp.photo, cp.posted 
                              FROM members as m, profiles as p, clubs as c, club_photos as cp
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = cp.mem_id AND c.clb_id = cp.clb_id AND cp.posted > $feedTime ORDER BY cp.posted DESC" ;
                              
                $result = mysql_query($club_photo_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "fname" => $row["fname"], "photo_p2" => $row["p2"], "clb_id" => $row["clb1"], "title" => $row["name"], "folder" => $row["pfolder"], "folder2" => $row["cfolder"], "photo_small" => $row["photo_small"], "photo_med" => $row["photo_med"], "photo" => $row["photo"], "photo_id" => $row["pho_id"], "per_id" => $per_id, "type" => 18 );
            }
         }
         }
        }
//Club Photos End/////////////////        
//Video Commented//////////////
        if ($sectionsArray['video_commented'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);
        if ($row['video_commented'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);
         if ($row['video_commented'] == 1) {

            $video_commented_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small, p.updated, v.mem_id, v.vid_id, v.title, v.shash, vc.vid_id, vc.mem_id, vc.comment, vc.posted
                              FROM members as m, profiles as p, videos as v, video_comments as vc
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = vc.mem_id AND v.vid_id = vc.vid_id AND vc.posted > $feedTime ORDER BY vc.posted DESC" ;
                              
                $result = mysql_query($video_commented_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "fname" => $row["fname"], "photo_small" => $row["photo_small"], "vid_id" => $row["vid_id"], "title" => $row["title"], "shash" => $row["shash"], "comment" => $row["comment"], "folder" => $row["folder"], "type" => 21 );
            }
         }
         }
        }
//Video Commented End///////////        
//Status Update///
if ($sectionsArray['status_updated'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['status_updated'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['status_updated'] == 1) {
         
            $status_updated_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small, p.updated, s.mem_id, s.sts_id, s.ustatus, s.posted
                               FROM members as m, profiles as p, status as s
                              WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = s.mem_id AND s.posted > $feedTime ORDER BY s.posted DESC" ;
                              
                $result = mysql_query($status_updated_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "gender" => $row['gender'], "fname" => $row["fname"], "photo_small" => $row["photo_small"], "folder" => $row['folder'], "ustatus" => $row['ustatus'], "sts_id" =>$row['sts_id'],  "type" => 23 );
            }
         }
        }
        }
//Status Update End////
		
//Photo Commented//////////////
        if ($sectionsArray['photo_commented'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);
        if ($row['photo_commented'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);
         if ($row['photo_commented'] == 1) {

            $photo_commented_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small as p2, p.updated, ph.mem_id, ph.pho_id, ph.photo_small, ph.photo_med, ph.photo, pc.pho_id, pc.mem_id, pc.comment, pc.posted
                              FROM members as m, profiles as p, photos as ph, photos_comment as pc
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = pc.mem_id AND ph.pho_id = pc.pho_id AND pc.posted > $feedTime ORDER BY pc.posted DESC" ;
                              
                $result = mysql_query($photo_commented_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "fname" => $row["fname"], "photo_p2" => $row["p2"], "pho_id" => $row["pho_id"],"photo_small" => $row["photo_small"], "photo_med" => $row["photo_med"], "photo" => $row["photo"], "comment" => $row["comment"], "folder" => $row["folder"], "type" => 25 );
            }
         }
         }
        }
//Photo Commented End/////////// 
//Photos Shared//////////////
        if ($sectionsArray['photo_shared'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['photo_shared'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['photo_shared'] == 1) {
         
            $photo_shared_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small as p2, p.updated, qp.phq_id, qp.mem_id, qp.photo_small, qp.photo_med, qp.photo, qp.posted, qp.caption
                              FROM members as m, profiles as p, qphotos as qp
                             WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = qp.mem_id AND qp.posted > $feedTime ORDER BY qp.posted DESC" ;
                              
                $result = mysql_query($photo_shared_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "fname" => $row["fname"], "photo_p2" => $row["p2"], "folder" => $row['folder'], "photo_small" => $row["photo_small"], "photo_med" => $row["photo_med"], "photo" => $row["photo"], "photo_id" => $row["pho_id"], "per_id" => $per_id, "caption" => $row["caption"], "type" => 27 );
            }
         }
        }
        }
//Photos Shared End///////////
		
//Link Shared///
if ($sectionsArray['link_shared'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['link_shared'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['link_shared'] == 1) {
         
            $link_shared_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small, p.updated, l.mem_id, l.lnk_id, l.link, l.comment, l.posted
                               FROM members as m, profiles as p, qlink as l
                              WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = l.mem_id AND l.posted > $feedTime ORDER BY l.posted DESC" ;
                              
                $result = mysql_query($link_shared_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "gender" => $row['gender'], "fname" => $row["fname"], "photo_small" => $row["photo_small"], "folder" => $row['folder'], "link" => $row['link'], "comment" => $row['comment'], "type" => 29 );
            }
         }
        }
        }
//Link Shared End////
		
[B]//Status Comment///
if ($sectionsArray['status_comment'] == 1) {
        
        $sqlquery = mysql_query("SELECT * from myfeed_config_friends_display WHERE mem_id = ".$info['mem_id']."");
        $row = mysql_fetch_array($sqlquery);    
        if ($row['status_comment'] == 1) {
        
         $sqlquery = mysql_query("SELECT * from myfeed_config_friends WHERE mem_id = ".$res['mem_id']."");
         $row = mysql_fetch_array($sqlquery);    
         if ($row['status_comment'] == 1) {
         
            $status_comment_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small, p.updated, s.mem_id, s.sts_id, s.ustatus, sc.mem_id, sc.sts_id as sc1, sc.stc_id, sc.comment, sc.posted, f.per_id
                               FROM members as m, profiles as p, status as s, statuscomment as sc, friends as f
                              WHERE ".$res['mem_id']." = m.mem_id AND ".$res['mem_id']." = p.mem_id AND ".$res['mem_id']." = sc.mem_id AND s.sts_id = sc.sts_id AND sc.posted > $feedTime ORDER BY sc.posted DESC" ;
                              
                $result = mysql_query($status_comment_query) or die('Error: '.mysql_error());
                while($me = mysql_fetch_array($result)){
					
			$status_friend_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder as folder2, p.gender, p.photo_small as p2, p.updated, s.mem_id, s.sts_id, s.ustatus
                               FROM members as m, profiles as p, status as s
                              WHERE m.mem_id = ".$me['per_id']." AND p.mem_id = ".$me['per_id']."
 AND m.mem_id = s.mem_id AND s.sts_id = ".$me['sts_id']."" ;		
							  
				$friend_result = mysql_query($status_friend_query) or die('Error: '.mysql_error());
                while($friend = mysql_fetch_array($friend_result)){			  
				
											                
                $newsfeed[] = array("time" => ($me['posted']), "gender" => $me['gender'], "fname" => $me['fname'], "fname2" => $friend['fname'],  "photo_small" => $me['photo_small'], "p2" => $friend['p2'], "folder" => $me['folder'], "folder2" => $friend['folder2'], "ustatus" => $me['ustatus'], "fstatus" => $friend['ustatus'], "st2" => $friend['sts_id'], "comment" => $me['comment'], "type" => 43 );
            }
         }
        }
        }
}
//Status Comment End////[/B]
		}
		
//Status Updates///

            $status_updates_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small,  p.updated, s.mem_id, s.sts_id, s.ustatus, s.posted
                               FROM members as m, profiles as p, status as s
                              WHERE ".$info['mem_id']." = m.mem_id AND ".$info['mem_id']." = p.mem_id AND ".$info['mem_id']." = s.mem_id AND s.posted > $feedTime ORDER BY s.posted DESC" ;
                              
                $result = mysql_query($status_updates_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "gender" => $row['gender'], "fname" => $row["fname"], "folder" => $row['folder'], "mystatus" => $row['ustatus'], "photo_small" => $row['photo_small'], "type" => 37 );
        
			}
//Status Updates End//// 
//Photos Shared//////////////
        
         
            $photo_shared2_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small as p2, p.updated, qp.phq_id, qp.mem_id, qp.photo_small, qp.photo_med, qp.photo, qp.posted, qp.caption
                              FROM members as m, profiles as p, qphotos as qp
                             WHERE ".$info['mem_id']." = m.mem_id AND ".$info['mem_id']." = p.mem_id AND ".$info['mem_id']." = qp.mem_id AND qp.posted > $feedTime ORDER BY qp.posted DESC" ;
                              
                $result = mysql_query($photo_shared2_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "fname" => $row["fname"], "photo_p2" => $row["p2"], "folder" => $row['folder'], "photo_small" => $row["photo_small"], "myphoto_med" => $row["photo_med"], "myphoto" => $row["photo"], "photo_id" => $row["pho_id"], "per_id" => $per_id, "mycaption" => $row["caption"], "type" => 39 );
           
        }
//Photos Shared End///////////
//Link Shared///

         
            $link_shared2_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small, p.updated, l.mem_id, l.lnk_id, l.link, l.comment, l.posted
                               FROM members as m, profiles as p, qlink as l
                              WHERE ".$info['mem_id']." = m.mem_id AND ".$info['mem_id']." = p.mem_id AND ".$info['mem_id']." = l.mem_id AND l.posted > $feedTime ORDER BY l.posted DESC" ;
                              
                $result = mysql_query($link_shared2_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
                
                $newsfeed[] = array("time" => ($row['posted']), "gender" => $row['gender'], "fname" => $row["fname"], "photo_small" => $row["photo_small"], "folder" => $row['folder'], "mylink" => $row['link'], "mycomment" => $row['comment'], "type" => 41 );
            
        }
//Link Shared End////
//Status Comments///
         
            $status_comments_query = "SELECT m.mem_id, m.fname, m.lname, p.mem_id, p.folder, p.gender, p.photo_small, p.updated, s.mem_id, s.sts_id, s.ustatus, sc.mem_id, sc.sts_id as sc1, sc.stc_id, sc.comment, sc.posted
                               FROM members as m, profiles as p, status as s, statuscomment as sc
                              WHERE ".$info['mem_id']." = m.mem_id AND ".$info['mem_id']." = p.mem_id AND ".$info['mem_id']." = sc.mem_id AND s.sts_id = sc.sts_id AND sc.posted > $feedTime ORDER BY sc.posted DESC" ;
                              
                $result = mysql_query($status_comments_query) or die('Error: '.mysql_error());
                while($row = mysql_fetch_array($result)){
				
											                
                $newsfeed[] = array("time" => ($row['posted']), "gender" => $row['gender'], "fname" => $row['fname'],  "photo_small" => $row['photo_small'], "folder" => $row['folder'], "myustatus" => $row['ustatus'], "sts_id" => $row['sts_id'], "mycomment" => $row['comment'], "type" => 45 );
            
        }

//Status Comments End////


		
    $newsfeed[] = $newsfeed;
		
    if (sizeof($newsfeed) > 0) {
    // sort the array
    uasort($newsfeed,'mySort');
    }    
		
    return $newsfeed;
        
}//newsfeed

}

$GLOBALS["Friends_feeds"] = new Friends_feeds;
?>

Output:

{if count($newsfeed)}
    {foreach from=$newsfeed item=item name=list}
    {if $smarty.foreach.list.iteration < $i}
<div>
				{if $item.type == 1}
<table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/user_edit.png" />
                        </div>
                        {if $item.gender == 0}
                        <div class="newsfeed_message">
                             <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}" ></a><div style="font-weight:bold; vertical-align:top"><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a></div> updated their profile.
                        </div>
                        {/if}
                        {if $item.gender == 1}
						<div class="newsfeed_message">
							 <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}" ></a><div style="font-weight:bold; vertical-align:top"><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a></div> updated his profile.
						</div>
                        {/if}
                        {if $item.gender == 2}
						<div class="newsfeed_message">
							 <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}" ></a><div style="font-weight:bold; vertical-align:top"><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a> </div>updated her profile.
						</div>
                        {/if}
						<div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>
  </div>             </td>
  </tr>
</table>
             
               
               {/if}

         
           
                
                {if $item.type == 2}

                      <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/pic_upload.png" />
                        </div>
						<div class="newsfeed_message">
							 <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_p2}" ></a><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a> uploaded new pictures.
						</div>
						<div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>  
                        <div style="clear:both; padding:3px;"></div>
                        <div class="newsfeed_pic">
                        <a href="{$url}/photos/{$item.photo}" rel="ibox"><img src="{$url}/photos/{$item.photo_med}" border="0"/></a>
                        </div>
                     </div>      </td>
  </tr>
</table>          

                 {/if}
                
				{if $item.type == 3}
					
                     <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/blogs.png" />
                        </div>
						<div class="newsfeed_message">
							 <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}"></a><a href="{$url}/profiles/{$item.pf}" target="_parent">{$item.fname}</a> posted the blog <a href="{$url}/blogs/{$item.folder}" target="_parent"><b>{$item.title}</b></a>.
						</div>
						<div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>  
                     </div> 
              </td>
  </tr>
</table>

                 {/if}
				
                {if $item.type == 5}
                 
                    <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/blog_add.png" />
                        </div>
						<div class="newsfeed_message">
							 <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}"></a><a href="{$url}/profiles/{$item.pf}" target="_parent">{$item.fname}</a> added the blog post <a href="{$url}/blogs/{$item.folder}/index.php?pst_id={$item.pst_id}" target="_parent"><b>'{$item.title_post}'</b></a> to the blog <a href="{$url}/blogs/{$item.folder}" target="_parent"><b>{$item.title_blog}</b></a>.
						</div>
						<div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>  
                     </div></td>
  </tr>
</table>
                      
                
                 {/if}

				{if $item.type == 6}
 
                     <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/comment_add.png" />
                        </div>
						<div class="newsfeed_message">
							 <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}"></a><a href="{$url}/profiles/{$item.pf}" target="_parent">{$item.fname}</a> said <div style="color:#000; font-style:italic;">"{$item.comment}"</div> about the Blog: <a href="{$url}/blogs/{$item.folder}/index.php?pst_id={$item.pst_id}" target="_parent"><b>'{$item.title_post}'</b></a> 
						</div>
						<div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>  
                     </div></td>
  </tr>
</table>

                                   
                 {/if}
                
                {if $item.type == 7}

                     <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/classifieds.png" />
                        </div>
						<div class="newsfeed_message">
							 <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}"></a><a href="{$url}/profiles/{$item.pf}" target="_parent">{$item.fname}</a> posted the Creative Piece <a href="{$url}/classifieds/{$item.folder}"><b>{$item.title}</b></a> 
						</div>
						<div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>  
                     </div>                     
</td>
  </tr>
</table>

                 {/if}

                {if $item.type == 8}

                     <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/clubs.png" />
                        </div>
						<div class="newsfeed_message">
							 <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}"></a><a href="{$url}/profiles/{$item.pf}" target="_parent">{$item.fname}</a> created the club <a href="{$url}/clubs/{$item.folder}" target="_parent"><b>{$item.title}</b></a> 
						</div>
						<div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>  
                     </div>  </td>
  </tr>
</table>
                   
{/if}
                
                {if $item.type == 9}

                 <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/events.png" />
                        </div>
						<div class="newsfeed_message">
							 <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}"></a><a href="{$url}/profiles/{$item.pf}" target="_parent">{$item.fname}</a> posted the event <a href="{$url}/events/{$item.folder}" target="_parent"><b>{$item.title}</b></a> 
						</div>
						<div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>  
                     </div> </td>
  </tr>
</table>
                        

                 {/if} 

                {if $item.type == 10}

                     <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/forum.png" />
                        </div>
						<div class="newsfeed_message">
							 <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}"></a><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a> posted <a href="{$url}/index.php?page=forum&section=topic&top_id={$item.top_id}" target="_parent"><b>{$item.subject}</b></a> in the <a href="{$url}/index.php?page=forum&section=forum&frm_id={$item.frm_id}" target="_parent"><b>{$item.title}</b></a> forum.
						</div>
						<div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>  
                     </div>  </td>
  </tr>
</table>
                   
                     
                 {/if} 

                {if $item.type == 11}

                   <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/music.png" /> 
                        </div>
						<div class="newsfeed_message">
							 <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}"></a><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a> uploaded the track <a href="{$url}/index.php?page=music&section=view&mus_id={$item.mus_id}" target="_parent"><b>{$item.title}</b></a> by {$item.artist} .
						</div>
						<div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>  
                     </div></td>
  </tr>
</table>
                      

                 {/if}


                {if $item.type == 12}

                     <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/video_add.png" /> 
                        </div>
						<div class="newsfeed_message">
							 <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}"></a><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a> posted the video <a href="{$url}/index.php?page=videos&section=view&vid_id={$item.vid_id}" target="_parent"><b>{$item.title}</b></a><p><a href="{$url}/index.php?page=videos&section=view&vid_id={$item.vid_id}" target="_parent"><img src="{$url}/scr/{$item.shash}_1.jpg" height="45", width="60" /></a></p>
                        </div>
						<div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>  
                     </div>                     
</td>
  </tr>
</table>

                 {/if}
                
                {if $item.type == 15}
                
					
                     <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/friends.png" /> 
                        </div>
						<div class="newsfeed_message">
							 <a href="{$url}/profiles/{$item.folder1}" target="_parent"><img src="{$url}/photos/{$item.photo_small}"></a><a href="{$url}/profiles/{$item.folder1}" target="_parent">{$item.fname1}</a> is now friends with <b><a href="{$url}/profiles/{$item.folder2}" target="_parent">{$item.fname2}</b></a>.
						</div>
                        <div class="newsfeed_time">
							 {$item.time|extract_time}
						</div> 						
                     </div> ;</td>
  </tr>
</table>
                    
                {/if}
                {if $item.type == 16}

                     <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/polls.png" /> 
                        </div>
						<div class="newsfeed_message">
							  <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}"></a><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a> created the poll titled  <a href="{$url}/index.php?page=polls" target="_parent">{$item.question}</b></a>.
						</div>
                        <div class="newsfeed_time">
							 {$item.time|extract_time}
						</div> 						
                     </div></td>
  </tr>
</table>
                     

                {/if}  
                
                {if $item.type == 17}

                     <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/bulletin.png" /> 
                        </div>
						<div class="newsfeed_message">
							  <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}"></a><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a> posted the bulletin  <a href="{$url}/index.php?page=bulletins&section=view&bul_id={$item.bul_id}">{$item.subject}</b></a>.
						</div>
                        <div class="newsfeed_time">
							 {$item.time|extract_time}
						</div> 						
                     </div> </td>
  </tr>
</table>
                    

               {/if}
                
                {if $item.type == 18}

                     <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/pic_upload.png" /> 
                        </div>
						<div class="newsfeed_message">
							  <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_p2}"></a><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a> posted a photo to the club  <a href="{$url}/clubs/{$item.folder2}" target="_parent"><b>{$item.title}</b></a>.
						</div>
                        <div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>
                        <div style="clear:both; padding:3px;"></div>
                        <div class="newsfeed_pic">
                        <a href="{$url}/photos/{$item.photo}" rel="ibox"><img src="{$url}/photos/{$item.photo_med}" border="0"/></a>
                        </div> 						
                     </div> </td>
  </tr>
</table>
                    

               {/if}
                                             
                {if $item.type == 21}

                    <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/television_add.png" /> 
                        </div>
						<div class="newsfeed_message">
							  <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}"></a><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a> said <div style="color:#000; font-style:italic;">"{$item.comment}"</div> about the video <a href="{$url}/index.php?page=videos&section=view&vid_id={$item.vid_id}" target="_parent">{$item.title}</a><p><a href="{$url}/index.php?page=videos&section=view&vid_id={$item.vid_id}" target="_parent"><img src="{$url}/scr/{$item.shash}_1.jpg" height="45", width="60" /></a></p> 
						</div>
                        <div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>			
                     </div>                     
</td>
  </tr>
</table>
 
                {/if}
                {if $item.type == 23}

                    <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/comment_add.png" />
                        </div>
                        
                        <div class="newsfeed_message">
                             <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}" ></a><div style="font-weight:bold;"><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a></div> <div style="color:#000; text-align:right; ">{$item.ustatus}</div>
                        </div>
                        
						<div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>
                        <br />
                       <table width="260" bgcolor="#666666" bordercolor="#666666" style="border-style:solid" align="right">
  <tr>
    <td><form name="statuscomment" action="index.php" method="post">
<input type="hidden" name="handler" value="statuscomment">
<input type="hidden" name="action" value="add_status_comment">
<input type="hidden" name="sts_id" value="{$item.sts_id}">
	<div style="color:#F00; font-weight:bold; text-align:center">Comment</div>
	<div><textarea class="textarea" name="comment" style='height:40px;width:300px'></textarea></div>
<div class="marginTop5">
	<div style="text-align:center"><input name="submit" type="submit" value="Post Comment" onclick=""></div>
</div>
</form>
</td>
  </tr>
</table>
<div style="text-align:right; font-size:10px;" ></div>
  </div>                 </td>
  </tr>
</table>
         
              
               
                 {/if}


                {if $item.type == 29}

                     <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/comment_add.png" />
                        </div>
                        <div class="newsfeed_message">
                             <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_small}" ></a><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a> said that <a href="http://{$item.link}" target="_blank"> http://{$item.link}</a> <div style="color:#000; font-style:italic;">{$item.comment}</div>
                        </div>
                        <div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>
  </div>         </td>
  </tr>
</table>
                 
               
                {/if}
                {if $item.type == 25}

                     <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/comment_add.png" /> 
                        </div>
						<div class="newsfeed_message">
							  <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_p2}"></a><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a> said <div style="color:#000; font-style:italic;">"{$item.comment}"</div> about <p><a href="{$url}/photos/{$item.photo}" rel="ibox"><img src="{$url}/photos/{$item.photo_med}" border="0"/></a></p> 
						</div>
                        <div class="newsfeed_time">
							 {$item.time|extract_time}
						</div>			
                     </div> </td>
  </tr>
</table>
                    

                {/if}
                {if $item.type == 27}
 <table width="500" style="border-bottom-style:ridge; border-bottom-color:#F00;">
  <tr>
    <td><div class="newsfeed_holder">
                        <div class="newsfeed_icon">
                        <img src="{$root}/icons/pic_upload.png" /> 
                        </div>
						<div class="newsfeed_message">
							  <a href="{$url}/profiles/{$item.folder}" target="_parent"><img src="{$url}/photos/{$item.photo_p2}"></a><a href="{$url}/profiles/{$item.folder}" target="_parent">{$item.fname}</a> shared the pic <p><a href="{$url}/photos/{$item.photo}" rel="ibox"><img src="{$url}/photos/{$item.photo_med}" border="0"/></a></p> and said <div style="color:#000; font-style:italic;">"{$item.caption}"</div>  
						</div>
                        <div class="newsf