Changeset 1280 in ExiteCMS


Ignore:
Timestamp:
02/14/08 15:02:48 (4 years ago)
Author:
hverton
Message:

added user option to show/hide the users own posts from the unread posts count

Location:
trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/administration/tools/language_pack_English.php

    r1262 r1280  
    30773077        $localestrings['u033'] = "Open"; 
    30783078        $localestrings['u034'] = "Closed"; 
    3079         $localestrings['u035'] = ""; 
     3079        $localestrings['u035'] = "Show your own posts as unread"; 
    30803080        $localestrings['u036'] = ""; 
    30813081        $localestrings['u037'] = "Html"; 
  • trunk/edit_profile.php

    r1240 r1280  
    144144    $user_newsletters = isNum($_POST['user_newsletters']) ? $_POST['user_newsletters'] : "1"; 
    145145    $user_forum_fullscreen = isNum($_POST['user_forum_fullscreen']) ? $_POST['user_forum_fullscreen'] : "0"; 
     146    $user_posts_unread = isNum($_POST['user_posts_unread']) ? $_POST['user_posts_unread'] : "0"; 
    146147    $user_theme = stripinput($_POST['user_theme']); 
    147148    $user_offset = isset($_POST['user_offset']) ? $_POST['user_offset'] : "+0"; 
     
    185186        } 
    186187        if ($user_newpassword != "") { $newpass = " user_password=md5(md5('$user_newpassword')), "; } else { $newpass = " "; } 
    187         $result = dbquery("UPDATE ".$db_prefix."users SET user_name='$username', user_fullname='$user_fullname', ".$newpass."user_email='".$_POST['user_email']."', user_bad_email = '0', user_hide_email='$user_hide_email', user_location='$user_location', user_birthdate='$user_birthdate', user_aim='$user_aim', user_icq='$user_icq', user_msn='$user_msn', user_yahoo='$user_yahoo', user_web='$user_web', user_forum_fullscreen='$user_forum_fullscreen', user_newsletters='$user_newsletters', user_theme='$user_theme', user_offset='$user_offset', ".$set_avatar."user_sig='$user_sig', user_locale='".$_POST['user_locale']."' WHERE user_id='".$this_userdata['user_id']."'"); 
     188        $result = dbquery("UPDATE ".$db_prefix."users SET user_name='$username', user_fullname='$user_fullname', ".$newpass."user_email='".$_POST['user_email']."', user_bad_email = '0', user_hide_email='$user_hide_email', user_location='$user_location', user_birthdate='$user_birthdate', user_aim='$user_aim', user_icq='$user_icq', user_msn='$user_msn', user_yahoo='$user_yahoo', user_web='$user_web', user_forum_fullscreen='$user_forum_fullscreen', user_posts_unread='$user_forum_posts_unread', user_newsletters='$user_newsletters', user_theme='$user_theme', user_offset='$user_offset', ".$set_avatar."user_sig='$user_sig', user_locale='".$_POST['user_locale']."' WHERE user_id='".$this_userdata['user_id']."'"); 
    188189        if ($user_theme != $userdata['user_theme']) redirect(FUSION_SELF."?status=1"); 
    189190        $result = dbquery("SELECT * FROM ".$db_prefix."users WHERE user_id='".$this_userdata['user_id']."'"); 
  • trunk/forum/index.php

    r1194 r1280  
    8080    // get the unread posts count for this forum 
    8181    if (iMEMBER) { 
    82         $result2 = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$data['forum_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     82        if ($userdata['user_posts_unread']) { 
     83            // include the users own posts 
     84            $result2 = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$data['forum_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     85        } else { 
     86            // filter the users own posts 
     87            $result2 = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$data['forum_id']."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     88        } 
    8389        $data['unread_posts'] = ($result2 ? mysql_result($result2, 0) : 0); 
    8490    } else { 
  • trunk/forum/viewforum.php

    r1278 r1280  
    6666} 
    6767 
    68 // get the number of unread posts in this forum 
    69 $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$forum_id."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
    70 $variables['unread_posts'] = ($result ? mysql_result($result, 0) : 0); 
    71  
    7268// if a forum rules custompage is given, check if it exists 
    7369$variables['rulespage_defined'] = false; 
     
    107103} 
    108104 
    109 // check for unread posts in this forum 
     105// get the number of unread posts in this forum 
    110106if (iMEMBER) { 
    111     $result = dbquery(" 
    112         SELECT count(*) as unread, sum(tr.thread_page) AS pages  
    113             FROM ".$db_prefix."posts p  
    114             LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id  
    115             WHERE tr.user_id = '".$userdata['user_id']."'  
    116                 AND tr.forum_id = '".$forum_id."' 
    117                 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].")  
    118                 AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 
    119         ", false); 
    120     $data['unread_count'] = ($result ? mysql_result($result, 0) : 0); 
     107    if ($userdata['user_posts_unread']) { 
     108        // include the users own posts 
     109        $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$forum_id."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     110    } else { 
     111        // filter the users own posts 
     112        $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND tr.forum_id = '".$forum_id."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     113    } 
     114    $variables['unread_posts'] = ($result ? mysql_result($result, 0) : 0); 
    121115} else { 
    122     $data['unread_count'] = 0; 
     116    $variables['unread_posts'] = 0; 
    123117} 
    124118 
  • trunk/forum/viewthread.php

    r1260 r1280  
    191191// number of unread posts in this thread 
    192192if (iMEMBER) { 
    193     $result = dbquery(" 
    194         SELECT count(*) as unread, tr.thread_last_read, tr.thread_page 
    195             FROM ".$db_prefix."posts p 
    196             LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 
    197             WHERE tr.user_id = '".$userdata['user_id']."'  
    198                 AND tr.thread_id = '".$thread_id."'  
    199                 AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].")  
    200                 AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 
    201             GROUP BY tr.thread_id 
    202         "); 
     193    if ($userdata['user_posts_unread']) { 
     194        // include the users own posts 
     195        $result = dbquery(" 
     196            SELECT count(*) as unread, tr.thread_last_read, tr.thread_page 
     197                FROM ".$db_prefix."posts p 
     198                LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 
     199                WHERE tr.user_id = '".$userdata['user_id']."'  
     200                    AND tr.thread_id = '".$thread_id."'  
     201                    AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].")  
     202                    AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 
     203                GROUP BY tr.thread_id 
     204            "); 
     205    } else { 
     206        // filter the users own posts 
     207        $result = dbquery(" 
     208            SELECT count(*) as unread, tr.thread_last_read, tr.thread_page 
     209                FROM ".$db_prefix."posts p 
     210                LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id 
     211                WHERE tr.user_id = '".$userdata['user_id']."' 
     212                    AND p.post_author != '".$userdata['user_id']."' 
     213                    AND p.post_edituser != '".$userdata['user_id']."' 
     214                    AND tr.thread_id = '".$thread_id."'  
     215                    AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].")  
     216                    AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read) 
     217                GROUP BY tr.thread_id 
     218            "); 
     219    } 
    203220    if (dbrows($result)) { 
    204221        $data = dbarray($result); 
  • trunk/includes/templates/main.edit_profile.tpl

    r1130 r1280  
    102102                <input type='radio' name='user_forum_fullscreen' value='1' {if $this_userdata.user_forum_fullscreen == "1"}checked="checked"{/if} />{$locale.u007} 
    103103                <input type='radio' name='user_forum_fullscreen' value='0' {if $this_userdata.user_forum_fullscreen == "0"}checked="checked"{/if} />{$locale.u008} 
     104            </td> 
     105        </tr> 
     106        <tr> 
     107            <td class='tbl'> 
     108                {$locale.u035} 
     109            </td> 
     110            <td class='tbl'> 
     111                <input type='radio' name='user_posts_unread' value='1' {if $this_userdata.user_posts_unread == "1"}checked="checked"{/if} />{$locale.u007} 
     112                <input type='radio' name='user_posts_unread' value='0' {if $this_userdata.user_posts_unread == "0"}checked="checked"{/if} />{$locale.u008} 
    104113            </td> 
    105114        </tr> 
  • trunk/modules/user_info_panel/user_info_panel.php

    r1220 r1280  
    3232    } 
    3333    $variables['new_pm_msg'] = dbcount("(pmindex_id)", "pm_index", "pmindex_user_id ='".$userdata['user_id']."' AND pmindex_to_id='".$userdata['user_id']."' AND pmindex_read_datestamp = '0'"); 
    34     $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     34    if ($userdata['user_posts_unread']) { 
     35        // include the users own posts 
     36        $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     37    } else { 
     38        // filter the users own posts 
     39        $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     40    } 
    3541    $variables['new_post_msg'] = ($result ? mysql_result($result, 0) : 0); 
    3642    // check if the forum_threads_list_panel module is installed 
  • trunk/themes/ExiteCMS/theme.php

    r1194 r1280  
    6666// unread forum post indicator 
    6767if (iMEMBER) { 
    68     $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     68    if ($userdata['user_posts_unread']) { 
     69        // include the users own posts 
     70        $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     71    } else { 
     72        // filter the users own posts 
     73        $result = dbquery("SELECT count(*) as unread, sum(tr.thread_page) AS pages FROM ".$db_prefix."posts p LEFT JOIN ".$db_prefix."threads_read tr ON p.thread_id = tr.thread_id WHERE tr.user_id = '".$userdata['user_id']."' AND p.post_author != '".$userdata['user_id']."' AND p.post_edituser != '".$userdata['user_id']."' AND (p.post_datestamp > ".$settings['unread_threshold']." OR p.post_edittime > ".$settings['unread_threshold'].") AND (p.post_datestamp > tr.thread_last_read OR p.post_edittime > tr.thread_last_read)", false); 
     74    } 
    6975    $variables['new_posts'] = ($result ? mysql_result($result, 0) : 0); 
    7076} else { 
Note: See TracChangeset for help on using the changeset viewer.