[MOD] MCP info on index

แนะนำ Mod ต่างๆ ของ PHPBB3 แนะนำความสามารถ ของ mod การติดตั้ง การเข้ากันได้กับเวอร์ชั่น

Moderator: mindphp

ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

[MOD] MCP info on index

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

8-5-2557 10-54-36.png
8-5-2557 10-54-36.png (41.23 KiB) Viewed 5753 times
รายละเอียด ::แสดงจำนวนรายงานโพสต์ของผู้ใช้งานที่ยังไม่ได้มีการอนุมัติในกล่องสีแดงในหน้า Index ด้วย MOD นี้คุณจะไม่พลาดรายงานใด ๆ การรายงานจะแสดงเเละมองเห็นสำหรับในส่วนของ admin
พัฒนาโดย ::Derky
Version :: 1.0.4
ดาวน์โหลดได้ที่ ::https://www.mindphp.com/download/files/53-51-mcp-info-on-inde-1-0-4-zip.html
ไฟล์ที่ใช้ในการติดตั้ง ::
index.php,
language/en/mcp.php,
styles/prosilver/template/index_body.html
วิธีการติดตั้ง::
เปิดไฟล์=>index.php
ค้นหา ::

โค้ด: เลือกทั้งหมด

// Assign index specific vars   
เติมก่อน ::

โค้ด: เลือกทั้งหมด

// Show amount of reported and queue posts for authenticated users
if ($auth->acl_getf_global('m_report') || $auth->acl_getf_global('m_approve'))
{
    if (!function_exists('get_forum_list'))
    {
        include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
    }
    $user->add_lang('mcp');
    
    // Reported Posts
    $forum_list = get_forum_list('m_report');
    if (!empty($forum_list))
    {
        $sql = 'SELECT COUNT(r.report_id) AS total_reported
            FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p
            WHERE r.post_id = p.post_id
                AND r.report_closed = 0
                AND ' . $db->sql_in_set('p.forum_id', $forum_list);
        $result = $db->sql_query($sql);
        $total_reported = (int) $db->sql_fetchfield('total_reported');
        $db->sql_freeresult($result);

        if ($total_reported)
        {            
            $template->assign_vars(array(
                'L_REPORTS_TOTAL'    => ($total_reported == 1) ? $user->lang['REPORT_TOTAL'] : sprintf($user->lang['REPORTS_TOTAL'], $total_reported),
                'U_MCP_REPORTS'        => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports'))
            );
        }
    }
    
    // Reported PMs
    $sql = 'SELECT COUNT(report_id) AS total_pm_reported
        FROM ' . REPORTS_TABLE . '  
        WHERE pm_id <> 0
            AND report_closed = 0';
    $result = $db->sql_query($sql);
    $total_pm_reported = (int) $db->sql_fetchfield('total_pm_reported');
    $db->sql_freeresult($result);

    if ($total_pm_reported)
    {            
        $template->assign_vars(array(
            'L_PM_REPORTS_TOTAL'    => ($total_pm_reported == 1) ? $user->lang['PM_REPORT_TOTAL'] : sprintf($user->lang['PM_REPORTS_TOTAL'], $total_pm_reported),
            'U_MCP_PM_REPORTS'        => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports'))
        );
    }
    
    // Posts and Topics in the Queue
    $forum_list = get_forum_list('m_approve');
    if (!empty($forum_list))
    {
        // Get the queue topics and posts in 1 query :)
        $sql = 'SELECT COUNT(t.topic_id) AS total_queue_topics, (
                            SELECT COUNT(p.post_id) 
                            FROM ' . POSTS_TABLE . ' p 
                            WHERE p.post_approved = 0
                                AND ' . $db->sql_in_set('p.forum_id', $forum_list) . ' ) AS total_queue_posts
                FROM ' . TOPICS_TABLE . ' t
                WHERE t.topic_approved = 0
                    AND ' . $db->sql_in_set('t.forum_id', $forum_list);
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);

        // Topics contain posts, so let's remove these
        $total_queue_posts = $row['total_queue_posts'] - $row['total_queue_topics'];        
        $total_queue_topics = $row['total_queue_topics'];
        
        if ($total_queue_posts)
        {
            $template->assign_vars(array(
                'L_UNAPPROVED_POSTS_TOTAL'    => ($total_queue_posts == 1) ? $user->lang['UNAPPROVED_POST_TOTAL'] : sprintf($user->lang['UNAPPROVED_POSTS_TOTAL'], $total_queue_posts),
                'U_MCP_POSTS_QUEUE'            => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_posts'))
            );
        }
        
        if ($total_queue_topics)
        {
            $template->assign_vars(array(
                'L_UNAPPROVED_TOPICS_TOTAL'    => ($total_queue_topics == 1) ? $user->lang['UNAPPROVED_TOPIC_TOTAL'] : sprintf($user->lang['UNAPPROVED_TOPICS_TOTAL'], $total_queue_topics),
                'U_MCP_TOPICS_QUEUE'        => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_topics'))
            );
        }
        
    }    
} 
เปิดไฟล์=>language/en/mcp.php
ค้นหา ::

โค้ด: เลือกทั้งหมด

'UNAPPROVED_POST_TOTAL'            => 'In total there is <strong>1</strong> post waiting for approval.',
ต่อท้าย::

โค้ด: เลือกทั้งหมด

// MCP info on index
    'UNAPPROVED_TOPICS_TOTAL'        => 'In total there are <strong>%d</strong> topics waiting for approval.',
    'UNAPPROVED_TOPICS_ZERO_TOTAL'    => 'There are no topics waiting for approval.',
    'UNAPPROVED_TOPIC_TOTAL'        => 'In total there is <strong>1</strong> topic waiting for approval.',
เปิดไฟล์=>styles/prosilver/template/index_body.html
ค้นหา ::

โค้ด: เลือกทั้งหมด

<!-- INCLUDE overall_header.html -->
ต่อท้าย::

โค้ด: เลือกทั้งหมด

<!-- IF U_MCP_REPORTS or U_MCP_PM_REPORTS or U_MCP_POSTS_QUEUE or U_MCP_TOPICS_QUEUE -->
<div id="message" class="rules">
    <div class="inner"><span class="corners-top"><span></span></span>
        <strong>{L_INFORMATION}:</strong>
        <ul>
        <!-- IF U_MCP_REPORTS --><li><a href="{U_MCP_REPORTS}">{L_REPORTS_TOTAL}</a></li><!-- ENDIF -->
        <!-- IF U_MCP_PM_REPORTS --><li><a href="{U_MCP_PM_REPORTS}">{L_PM_REPORTS_TOTAL}</a></li><!-- ENDIF -->
        <!-- IF U_MCP_POSTS_QUEUE --><li><a href="{U_MCP_POSTS_QUEUE}">{L_UNAPPROVED_POSTS_TOTAL}</a></li><!-- ENDIF -->
        <!-- IF U_MCP_TOPICS_QUEUE --><li><a href="{U_MCP_TOPICS_QUEUE}">{L_UNAPPROVED_TOPICS_TOTAL}</a></li><!-- ENDIF -->
        </ul>
    <span class="corners-bottom"><span></span></span></div>
</div>
<!-- ENDIF -->
หลังจากนั้นให้ทำการ refresh
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 63