Page 1 of 1

New posts counter

Posted: 31. January 2009 21:59
by ttkk
Your Portal Version: 1.0.2
Your phpBB Type: Standard phpBB3
MODs installed: Yes
Your knowledge: Basic Knowledge

What have you done before the problem was there?
Maybe mod, that just add after each 1st and last post advertisement. But i am not sure, if after that was this problem. And I have Phpgallery installed

What have you already tryed to solve the problem?
nothing, cause I dont know what

Description and Message
Hello,

my problem is, that 2 years everything works perfect, I had Phpbb3portal, and after login, I can see how much new posts are in the forum.

But now, it seems, that after login I can see only in how many topic are new posts.

So, for example, if there are 5 new posts in 1 topic, I can see that only 1 new post is in my forum.
But if these 5 posts are in 3 different topics, I can see that 3 new posts are in my forum.

It is strange... :cry:

I speak about the user menu on the main page in the portal, where is New posts (x) or something like this.

Thanks for help

Re: New posts counter

Posted: 31. January 2009 22:24
by thomas.d
Hi ttkk,

this is by design.

It was the other way round before, but a lot of users wanted it like it is now.

Re: New posts counter

Posted: 31. January 2009 22:29
by ttkk
And what if I want to count new posts like it was?

Re: New posts counter

Posted: 1. February 2009 01:05
by thomas.d
This is the code of user_menu.php (version RC1), before the change to what it is now:

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: user_menu.php 142 2008-03-09 17:19:34Z kevin74 $
* @copyright (c) kevin / saint ( http://www.board3.de/ ), (c) Ice, (c) nickvergessen ( http://www.flying-bits.org/ ), (c) redbull254 ( http://www.digitalfotografie-foren.de )
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB'))
{
   exit;
}

if (!defined('IN_PORTAL'))
{
   exit;
}

//
// + new posts since last visit & you post number
//
if ($user->data['is_registered'])
{
    // new posts since last visit
    $sql = "SELECT COUNT(distinct post_id) as total
        FROM " . POSTS_TABLE . "
        WHERE post_time >= " . $user->data['session_last_visit'];
    $result = $db->sql_query($sql);
    $new_posts_count = (int) $db->sql_fetchfield('total');
        
    // your post number
    $sql = "SELECT user_posts
        FROM " . USERS_TABLE . "
        WHERE user_id = " . $user->data['user_id'];
    $result = $db->sql_query($sql);
    $you_posts_count = (int) $db->sql_fetchfield('user_posts');
}
//
// - new posts since last visit & you post number
//


// Get user...
$user_id = $user->data['user_id'];
$username = $user->data['username'];

$sql = 'SELECT *
    FROM ' . USERS_TABLE . '
    WHERE ' . (($username) ? "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "user_id = $user_id");
$result = $db->sql_query($sql);
$member = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$avatar_img = get_user_avatar($member['user_avatar'], $member['user_avatar_type'], $member['user_avatar_width'], $member['user_avatar_height']);
$rank_title = $rank_img = '';
get_user_rank($member['user_rank'], $member['user_posts'], $rank_title, $rank_img, $rank_img_src);
$username = $member['username'];
$user_id = (int) $member['user_id'];
$colour = $member['user_colour'];

// Assign specific vars
$template->assign_vars(array(
    'L_NEW_POSTS'    => $user->lang['SEARCH_NEW'] . '&nbsp;(' . $new_posts_count . ')',
    'L_SELF_POSTS'    => $user->lang['SEARCH_SELF'] . '&nbsp;(' . $you_posts_count . ')',

    'AVATAR_IMG'    => $avatar_img,
    
    'RANK_TITLE'    => $rank_title,
    'RANK_IMG'        => $rank_img,
    'RANK_IMG_SRC'    => $rank_img_src,

    'USERNAME_FULL'        => get_username_string('full', $user_id, $username, $colour),
    'USERNAME'            => get_username_string('username', $user_id, $username, $colour),
    'USER_COLOR'        => get_username_string('colour', $user_id, $username, $colour),
    'U_VIEW_PROFILE'    => get_username_string('profile', $user_id, $username, $colour),

    'U_NEW_POSTS'            => append_sid($phpbb_root_path . 'search.' . $phpEx . '?search_id=newposts'),
    'U_SELF_POSTS'            => append_sid($phpbb_root_path . 'search.' . $phpEx . '?search_id=egosearch'),
    'U_UM_BOOKMARKS'      => ($config['allow_bookmarks']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "i=main&mode=bookmarks") : '',
    'U_UM_MAIN_SUBSCRIBED'    => append_sid($phpbb_root_path . 'ucp.' . $phpEx . '?i=main&mode=subscribed'),
    'U_PRIVATE_MESSAGES'   => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox') : '',
));

?>

Re: New posts counter

Posted: 1. February 2009 09:20
by ttkk
I changed new posts in the new version by the new posts passage from the old version in user_menu.php from /portal/block/, and it is working now.

Thank you very much.

Lock please

Re: New posts counter

Posted: 26. March 2009 23:46
by kaya
ttkk wrote:I changed new posts in the new version by the new posts passage from the old version in user_menu.php from /portal/block/, and it is working now.

Thank you very much.

Lock please
Could you pleae show me exactly which files you replaced? It would me so noce if you could use Quotes

Re: New posts counter

Posted: 27. March 2009 12:36
by kaya
ttkk wrote:I changed new posts in the new version by the new posts passage from the old version in user_menu.php from /portal/block/, and it is working now.

Thank you very much.

Lock please


Could somebody explain me extacly which part of from old version was placed in to the new version of user_meu.php

I couldnt figure it out
thanks