Various modifications for phpBB3Mchat top poster

Snippets for phpBB3
Previous topicNext topic
User avatar

Topic Author
dmzx
Founder
Founder
Magic user status: Online
Posts: 5975
Joined: Jan 13th, '14, 20:45
    Windows 10 Firefox

Mchat top poster

Post by dmzx »

Mchat top poster

this will show a users Mchat post count (Not forum post count)

Open mchat.php
Find This may be a partial find and not the whole line

Code: Select all

// Run code...
            if ($mchat_view)
            {
Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

$sql = 'SELECT m.user_id, COUNT(m.message_id) AS post_count, u.username, u.user_colour
                    FROM ' . MCHAT_TABLE . ' m
                        LEFT JOIN ' . USERS_TABLE . ' u ON (m.user_id = u.user_id)
                        GROUP BY u.user_id ORDER BY post_count DESC';
                $result = $db->sql_query_limit($sql, 10);

                while ($row = $db->sql_fetchrow($result))
                {   
                    $template->assign_block_vars('mchaters', array(
                        'USER_NAME'        => get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour']) . ' (' . $row['post_count'] . ')',
                    ));
                }
                $db->sql_freeresult($result);
Open language/en/mods/mchat_lang.php
Find This may be a partial find and not the whole line

Code: Select all

'MCHAT_SMILES'                => 'Smilies',
Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

'MCHAT_TOP_POSTERS'            => 'Top Posters',
Open styles/your style/template/mchat_body.html
Find This may be a partial find and not the whole line

Code: Select all

<div style="text-align:center;">{L_MCHAT_COPYRIGHT}</div>
Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

<!-- IF .mchaters --><p><strong>{L_MCHAT_TOP_POSTERS}</strong><br/>
             <!-- BEGIN mchaters -->{mchaters.USER_NAME} <!-- IF not mchaters.S_LAST_ROW -->,<!-- ENDIF --><!-- END mchaters --></p><!-- ENDIF -->
binance.com ;) try it!
User avatar

Napster
Users
Users
Magic user status: Offline
Posts: 25
Joined: Sep 15th, '15, 13:35
    Windows 10 Firefox

Re: Mchat top poster

Post by Napster »

Hi, would love this but these edits are different on the new mchat extension is it possible to show me where new edits go please.
User avatar

Sniper_E
VIP
VIP
Magic user status: Offline
Posts: 1034
Joined: Oct 14th, '14, 17:01
    Windows 10 Firefox

Re: Mchat top poster

Post by Sniper_E »

The edits in the extension are close to the same.

Instead of editing the mchat.php you will edit the core/render_helper.php.
dmzx wrote:
Open core/render_helper.php
Find This may be a partial find and not the whole line [ line 1080 ]

Code: Select all

				// Run code...
				if ($mchat_view)
				{
Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

				$sql = 'SELECT m.user_id, COUNT(m.message_id) AS post_count, u.username, u.user_colour
                    FROM ' . $this->mchat_table . ' m
                        LEFT JOIN ' . USERS_TABLE . ' u ON (m.user_id = u.user_id)
                        GROUP BY u.user_id ORDER BY post_count DESC';
                $result = $this->db->sql_query_limit($sql, 10);

                while ($row = $this->db->sql_fetchrow($result))
                {   
                    $this->template->assign_block_vars('mchaters', array(
                        'USER_NAME'        => get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour']) . ' (' . $row['post_count'] . ')',
                    ));
                }
                $this->db->sql_freeresult($result);
And the edit to the mchat_body.html has a different Find.
dmzx wrote:
Open styles/prosilver/template/mchat_body.html
Find This may be a partial find and not the whole line [ line 1080 ]

Code: Select all

				{L_MCHAT_COPYRIGHT}
Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

				<!-- IF .mchaters --><p><strong>{L_MCHAT_TOP_POSTERS}</strong><br/>
				<!-- BEGIN mchaters -->{mchaters.USER_NAME} <!-- IF not mchaters.S_LAST_ROW -->,<!-- ENDIF --><!-- END mchaters --></p><!-- ENDIF -->
The language file edit is the same.
dmzx wrote:
Open language/en/common.php
Find This may be a partial find and not the whole line [ line 1080 ]

Code: Select all

	//Custom edits
	'REPLY_WITH_LIKE'	=>'Like This Post',
Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

					'MCHAT_TOP_POSTERS'	=> 'Top Posters',
Last edited by Sniper_E on Dec 20th, '15, 20:00, edited 1 time in total.
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!™
User avatar

Napster
Users
Users
Magic user status: Offline
Posts: 25
Joined: Sep 15th, '15, 13:35
    Windows 10 Firefox

Re: Mchat top poster

Post by Napster »

Thank you :buigen:
User avatar

alfi0815
Users
Users
Magic user status: Offline
Posts: 120
Joined: Jun 6th, '15, 10:41
    Windows 10 Opera

Re: Mchat top poster

Post by alfi0815 »

Hello,
and for mchat 1.0.0 RC1???
User avatar

Topic Author
dmzx
Founder
Founder
Magic user status: Online
Posts: 5975
Joined: Jan 13th, '14, 20:45
    Windows 10 Firefox

Re: Mchat top poster

Post by dmzx »

alfi0815 wrote: Feb 16th, '16, 18:26 Hello,
and for mchat 1.0.0 RC1???
There is in this section
User avatar

killfrenzy
Users
Users
Magic user status: Offline
Posts: 117
Joined: Feb 6th, '16, 18:22
    Windows 10 Chrome

Re: Mchat top poster

Post by killfrenzy »

Sniper_E wrote: Dec 20th, '15, 19:54 The edits in the extension are close to the same.

Instead of editing the mchat.php you will edit the core/render_helper.php.
dmzx wrote:
Open core/render_helper.php
Find This may be a partial find and not the whole line [ line 1080 ]

Code: Select all

				// Run code...
				if ($mchat_view)
				{
Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

				$sql = 'SELECT m.user_id, COUNT(m.message_id) AS post_count, u.username, u.user_colour
                    FROM ' . $this->mchat_table . ' m
                        LEFT JOIN ' . USERS_TABLE . ' u ON (m.user_id = u.user_id)
                        GROUP BY u.user_id ORDER BY post_count DESC';
                $result = $this->db->sql_query_limit($sql, 10);

                while ($row = $this->db->sql_fetchrow($result))
                {   
                    $this->template->assign_block_vars('mchaters', array(
                        'USER_NAME'        => get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour']) . ' (' . $row['post_count'] . ')',
                    ));
                }
                $this->db->sql_freeresult($result);
And the edit to the mchat_body.html has a different Find.
dmzx wrote:
Open styles/prosilver/template/mchat_body.html
Find This may be a partial find and not the whole line [ line 1080 ]

Code: Select all

				{L_MCHAT_COPYRIGHT}
Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

				<!-- IF .mchaters --><p><strong>{L_MCHAT_TOP_POSTERS}</strong><br/>
				<!-- BEGIN mchaters -->{mchaters.USER_NAME} <!-- IF not mchaters.S_LAST_ROW -->,<!-- ENDIF --><!-- END mchaters --></p><!-- ENDIF -->
The language file edit is the same.
dmzx wrote:
Open language/en/common.php
Find This may be a partial find and not the whole line [ line 1080 ]

Code: Select all

	//Custom edits
	'REPLY_WITH_LIKE'	=>'Like This Post',
Add after Add these lines on a new blank line after the preceding line(s) to find

Code: Select all

					'MCHAT_TOP_POSTERS'	=> 'Top Posters',
What version of mchat is this? I can't find render_helper.php in core folder. I'm using mchat 3.4
Compilation of Android Roms, Recoverys, Apps, Games and Tricks
Visit my blog http://androidcribs.com
Androidcribs.com
Androidcribs
Image
User avatar

Topic Author
dmzx
Founder
Founder
Magic user status: Online
Posts: 5975
Joined: Jan 13th, '14, 20:45
    Windows 10 Firefox

Re: Mchat top poster

Post by dmzx »

killfrenzy wrote: Feb 17th, '16, 03:44 Instead of editing the mchat.php you will edit the core/render_helper.php.
The latest version dont use render_helper no more.
There is now an extension for this (addon) to add the Top Poster, no need to edit anything no more.
User avatar

killfrenzy
Users
Users
Magic user status: Offline
Posts: 117
Joined: Feb 6th, '16, 18:22
    Windows 10 Chrome

Re: Mchat top poster

Post by killfrenzy »

dmzx wrote: Feb 17th, '16, 20:05
killfrenzy wrote: Feb 17th, '16, 03:44 Instead of editing the mchat.php you will edit the core/render_helper.php.
The latest version dont use render_helper no more.
There is now an extension for this (addon) to add the Top Poster, no need to edit anything no more.
This is for donators only latest version of mchat?
User avatar

Topic Author
dmzx
Founder
Founder
Magic user status: Online
Posts: 5975
Joined: Jan 13th, '14, 20:45
    Windows 10 Firefox

Re: Mchat top poster

Post by dmzx »

There is an extension in VIP indeed.
User avatar

sindyciaray
Users
Users
Magic user status: Offline
Posts: 1
Joined: Sep 15th, '17, 10:46
    Ubuntu Chrome

Re: Mchat top poster

Post by sindyciaray »

Seems like the real post here cheers I PROMISE I WONT POST BS LINKS TO FAT SITES NO MORE

edited by martin
User avatar

Topic Author
dmzx
Founder
Founder
Magic user status: Online
Posts: 5975
Joined: Jan 13th, '14, 20:45
    Windows 10 Chrome

Re: Mchat top poster

Post by dmzx »

sindyciaray wrote: Sep 15th, '17, 11:22 Seems like the real post here cheers I PROMISE I WONT POST BS LINKS TO FAT SITES NO MORE

edited by martin
:thumbup: Martin :lol:
Previous topicNext topic