[3.2][RC] User's Post Count on Index

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Scam Warning
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
Post Reply
User avatar
Restless Rancor
Registered User
Posts: 182
Joined: Tue Sep 18, 2018 1:51 pm

[3.2][RC] User's Post Count on Index

Post by Restless Rancor » Sat Oct 20, 2018 7:14 pm

Extension Name: User's Post Count on Index
Author: Restless Rancor

Extension Description: Displays a logged in member their post count on the index page.
Clicking the text will search their posts, matching the behavior of the post count in memberlist_body.html, memberlist_view.html,viewtopic_body.html etc.

Extension Version: Image
Requirements: Image Image

GitHub Repository: https://github.com/restless-rancor/rr-p ... t-on-index
Extension Download: https://github.com/restless-rancor/rr-p ... master.zip

Notes:
  • This is my first extension and I am always learning: I am not a competent extension writer/php developer.
  • As of v0.3.0-beta I do not plan to add any more to the extension. The next stage is to optimize and review code.
  • Only install this extension in a test environment.
Plans:
  • Set the default location to directly opposite 'Mark Forums Read'. (Not above and opposite). [DONE!]
  • /language/en/common.php [Done, needs improving.] [DONE!]
  • ACP options to change location: [DONE!]
    • Above forumlist
    • Next to Notifications
    • In Index Statistics
Screenshots:
Above Forumlist:
Image
Next to Notifications:
Image
In Statistics:
Image
ACP Options:
Image
Changelog:
d.m.Y H:i TO | version
  • 01.11.2018 17:44 UTC | 1.0.0-RC2
    • EOL Conversion > Unix (LF)
  • 01.11.2018 16:47 UTC | 1.0.0-RC1
    • (tr) Translation added
    • Push to version 1.0.0-RC1 for validation.
  • 01.11.2018 14:57 UTC | 0.3.3-beta
    • Code optimization to comply with phpBB coding guidelines.
    • Global enable/disable removed:
      • This setting was exactly the same as enabling/disabling the extension in Extension Management and therefore pointless.
    • phpBB syntax fully updated to Twig syntax.
  • 29.10.2018 15:54 UTC | 0.3.2-beta
    • 'Preview' button in ACP settings removed
    • ACP Language file renamed
  • 28.10.2018 13:56 UTC | 0.3.1-beta
    • Update acme_demo references in migrations
  • 28.10.2018 13:29 UTC | 0.3.0-beta
    • Twig syntax updated in adm/style/acp_pcoi_body.html
    • Added display location settings:
      • In Navbar
      • Above Forumlist
      • In Board Statistics
  • 28.10.2018 11:27 UTC | 0.2.1-dev
    • ACP module added:
      • Currently only with a global enable/disable option.
    • Template optimized:
      • {% if U_MARK_FORUMS %} moved so if 'mark forums read' is disabled the post count will still show if the extension is enabled.
    • Language updated.
  • 25.10.2018 16:32 UTC+1 | 0.2.0-dev
    • Removed duplicate language call
  • 22.10.2018 15:14 UTC+1 | 0.1.3-dev
    • Requirements updated to indicate supported version.
  • 21.10.2018 18:08 UTC+1 | 0.1.2-dev
    • Plurals in language now work as intended
    • phpBB syntax completely replaced with Twig syntax in templates
      • No need for {% if USER_POST_COUNT == '1' %} anymore.
    • Language file renamed to common.php
  • 21.10.2018 12:05 UTC+1 | 0.1.1-dev
    • Updated version check path
  • 20.10.2018 19:53 UTC+1 | 0.1.0-dev
    • Version change to 0.1.0-dev in prep for phpBB.com [DEV] topic.
  • 20.10.2018 17:01 UTC+1 | 0.0.6-dev
    • {% if U_MARK_FORUMS %} now has an {% endif %}. Whoops.
  • 20.10.2018 16:59 UTC+1 | 0.0.5-dev
    • phpBB syntax replaced with Twig syntax in template files.
  • 20.10.2018 14:36 UTC+1 | 0.0.4-dev
    • Added language files.
  • 20.10.2018 12:08 UTC+1 | 0.0.3-dev
    • Version check added.
  • 19.10.2018 20:16 UTC+1 | 0.0.2-dev
    • CSS added: The post count now displays directly opposite 'mark forums read' as desired.
  • 19.10.2018 16:47 UTC+1 | 0.0.1-dev
    • Initial development release.
Last edited by Restless Rancor on Thu Nov 01, 2018 5:48 pm, edited 20 times in total.
These aren't the droids you're looking for...
My Extensions and Snippets (Ref link)

User avatar
pikachuturkey
Registered User
Posts: 263
Joined: Wed Dec 20, 2006 10:34 pm
Name: Rıza
Contact:

Re: [DEV] User's Post Count on Index

Post by pikachuturkey » Sat Oct 20, 2018 8:45 pm

is there any screenshot? (for language translation)
Health For Everyone ==> www.saglikforum.org

User avatar
kinerity
Community Team Member
Community Team Member
Posts: 1940
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Truscott
Contact:

Re: [DEV] User's Post Count on Index

Post by kinerity » Sun Oct 21, 2018 3:00 am

Restless Rancor wrote:
Sat Oct 20, 2018 7:14 pm
  • I'm having trouble getting the language to produce plurals. (i.e. "Post" for 1 post and "Posts" for not 1 post). I'm going to give another crack at it tomorrow but will ask what I could be doing wrong if I can't get it.
The language system will handle this automatically. You only need to pass it one language var and the array of language definitions. For example, in one of my extensions.

Code: Select all

'PM_POST_LIMIT_ERROR'   => array(
    1  => 'Due to restrictions on this board, users must have a minimum of %d post and a registration date of more than 24 hours ago to proceed. You <strong>may</strong> still PM team members.',
    2  => 'Due to restrictions on this board, users must have a minimum of %d posts and a registration date of more than 24 hours ago to proceed. You <strong>may</strong> still PM team members.',
),
Hope this helps.
Kailey Truscott - Community Team

User avatar
Restless Rancor
Registered User
Posts: 182
Joined: Tue Sep 18, 2018 1:51 pm

Re: [DEV] User's Post Count on Index

Post by Restless Rancor » Sun Oct 21, 2018 10:57 am

pikachuturkey wrote:
Sat Oct 20, 2018 8:45 pm
is there any screenshot? (for language translation)
Hi, it's not really ready for translations yet as I want to change how the language is handled and this will mean changing the language file, but I'll add a couple of screenshots to support the OP.

kinerity wrote:
Sun Oct 21, 2018 3:00 am
The language system will handle this automatically. You only need to pass it one language var and the array of language definitions. For example, in one of my extensions.

Code: Select all

'PM_POST_LIMIT_ERROR'   => array(
    1  => 'Due to restrictions on this board, users must have a minimum of %d post and a registration date of more than 24 hours ago to proceed. You <strong>may</strong> still PM team members.',
    2  => 'Due to restrictions on this board, users must have a minimum of %d posts and a registration date of more than 24 hours ago to proceed. You <strong>may</strong> still PM team members.',
),
Hope this helps.
Hi kinerity, yep that's what I've been trying, but I think it's either in the listener or template where I'm falling over myself.

Code: Select all

$lang = array_merge($lang, array(
	'PCOI'	=> array(
		1	=> 'You have %d post.',
		2	=> 'You have %d posts!',
	),
));
But when using {L_PCOI} I get [phpBB Debug] PHP Warning: in file [ROOT]/phpbb/language/language.php on line 372: vsprintf(): Too few arguments - I'm fairly sure this is because I haven't told it to use {USER_POST_COUNT} in that array. So, hopefully I'll get that figured out today :?
These aren't the droids you're looking for...
My Extensions and Snippets (Ref link)

User avatar
kinerity
Community Team Member
Community Team Member
Posts: 1940
Joined: Mon Sep 01, 2014 1:00 am
Location: sudo rm -rf /
Name: Kailey Truscott
Contact:

Re: [DEV] User's Post Count on Index

Post by kinerity » Sun Oct 21, 2018 5:12 pm

Yes, you need to pass your var to the array.
Kailey Truscott - Community Team

User avatar
Restless Rancor
Registered User
Posts: 182
Joined: Tue Sep 18, 2018 1:51 pm

Re: [DEV] User's Post Count on Index

Post by Restless Rancor » Sun Oct 21, 2018 5:28 pm

  • 21.10.2018 18:08 UTC+1 | 0.1.2-dev
    • Plurals in language now work as intended
    • phpBB syntax completely replaced with Twig syntax in templates
      • No need for {% if USER_POST_COUNT == '1' %} anymore.
    • Language file renamed to common.php
I did have a lot of guidance on these changes, so am going to focus on learning precisely what's happening before moving forward with adding new features.
These aren't the droids you're looking for...
My Extensions and Snippets (Ref link)

User avatar
pikachuturkey
Registered User
Posts: 263
Joined: Wed Dec 20, 2006 10:34 pm
Name: Rıza
Contact:

Re: [DEV] User's Post Count on Index

Post by pikachuturkey » Sun Oct 21, 2018 7:46 pm

Why there is "!" for plural and "." for singular :D

Turkish (tr) language for "[DEV] User's Post Count on Index" version 0.1.2

language/tr/common.php

Code: Select all

<?php
if (!defined('IN_PHPBB'))
{
	exit;
}
if (empty($lang) || !is_array($lang))
{
	$lang = array();
}
$lang = array_merge($lang, array(
	'USER_POSTS'	=> array(
		0	=> 'Hiç gönderiniz yok.',
		1	=> '%d gönderiniz var.',
		2	=> '%d gönderiniz var!',
	),
));
Health For Everyone ==> www.saglikforum.org

User avatar
Restless Rancor
Registered User
Posts: 182
Joined: Tue Sep 18, 2018 1:51 pm

Re: [DEV] User's Post Count on Index

Post by Restless Rancor » Mon Oct 22, 2018 9:28 am

pikachuturkey wrote:
Sun Oct 21, 2018 7:46 pm
Why there is "!" for plural and "." for singular :D
That's just the way I've put it :)

I'll get the translation added soon, although there'll probably be more to add, as I plan on adding ACP options to chose where the post count is located.

Thanks.
Last edited by Restless Rancor on Mon Oct 22, 2018 2:25 pm, edited 1 time in total.
These aren't the droids you're looking for...
My Extensions and Snippets (Ref link)

User avatar
Restless Rancor
Registered User
Posts: 182
Joined: Tue Sep 18, 2018 1:51 pm

Re: [DEV] User's Post Count on Index

Post by Restless Rancor » Mon Oct 22, 2018 2:18 pm

I've updated the requirements to php >=5.6 and phpBB >=3.2.0<3.3 to clarify and indicate the supported versions. The extension may work on earlier versions, but it is not guaranteed.
These aren't the droids you're looking for...
My Extensions and Snippets (Ref link)

User avatar
david63
Jr. Extension Validator
Posts: 14893
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: [DEV] User's Post Count on Index

Post by david63 » Mon Oct 22, 2018 2:26 pm

Restless Rancor wrote:
Mon Oct 22, 2018 2:18 pm
The extension may work on earlier versions
It will not work on 3.1.x
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

User avatar
Restless Rancor
Registered User
Posts: 182
Joined: Tue Sep 18, 2018 1:51 pm

Re: [DEV] User's Post Count on Index

Post by Restless Rancor » Mon Oct 22, 2018 2:28 pm

david63 wrote:
Mon Oct 22, 2018 2:26 pm
Restless Rancor wrote:
Mon Oct 22, 2018 2:18 pm
The extension may work on earlier versions
It will not work on 3.1.x
Thanks for clarifying. I'd originally had it set to >=3.1.9<3.2.0@dev as the template event it uses was introduced in 3.1.9, and I interpreted that as ">=3.1.9<3.2 development branch".

Always a learning process. From now on it'd be indicating the latest stable branch I've tested it on. When 3.3 is released if the ext works I can expand the parameters etc. or update the ext :geek:
These aren't the droids you're looking for...
My Extensions and Snippets (Ref link)

User avatar
Restless Rancor
Registered User
Posts: 182
Joined: Tue Sep 18, 2018 1:51 pm

Re: [3.2][DEV] User's Post Count on Index

Post by Restless Rancor » Sat Oct 27, 2018 8:22 pm

I've had quite a bit of difficulty adding an ACP module this week, but the solution struck me earlier today and I finally have the acme demo module working with the extension.
More info on that if you're interested...

This week I aim to tailor that to the extension, adding a 'location on index' and a global enable/disable setting.
These aren't the droids you're looking for...
My Extensions and Snippets (Ref link)

User avatar
Restless Rancor
Registered User
Posts: 182
Joined: Tue Sep 18, 2018 1:51 pm

Re: [3.2][BETA] User's Post Count on Index

Post by Restless Rancor » Sun Oct 28, 2018 1:45 pm

  • 28.10.2018 13:29 UTC | 0.3.0-beta
    • Twig syntax updated in adm/style/acp_pcoi_body.html
    • Added display location settings:
      • In Navbar
      • Above Forumlist
      • In Board Statistics
As of 0.3.0-beta, the extension has everything I originally planned, so the next step is to review and optimize the code.
Suggestions for improvements are greatly appreciated :mrgreen:
These aren't the droids you're looking for...
My Extensions and Snippets (Ref link)

User avatar
pikachuturkey
Registered User
Posts: 263
Joined: Wed Dec 20, 2006 10:34 pm
Name: Rıza
Contact:

Re: [3.2][BETA] User's Post Count on Index

Post by pikachuturkey » Thu Nov 01, 2018 4:10 pm

Turkish (tr) translation of "[3.2][BETA] User's Post Count on Index" (version: 0.3.3 ////// 01.11.2018 github datas)

language/tr/info_acp_pcoi.php

Code: Select all

<?php
/**
*
* Post Count on Index. An extension for the phpBB Forum Software package.
*
* @copyright (c) 2018, Restless Rancor, https://www.restlessrancor.com
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/
if (!defined('IN_PHPBB'))
{
	exit;
}
if (empty($lang) || !is_array($lang))
{
	$lang = array();
}
$lang = array_merge($lang, array(
	'PCOI_TITLE'			=> 'İndekste Gönderi Sayısı',
	'PCOI_SETTINGS'			=> 'Ayarlar',
	'PCOI_ENABLE_FAIL'		=> 'Eklentiyi aktifleştirme başarısız!',
	'PCOI_ENABLE_SUCCESS'	=> 'Başarıyla aktifleştirildi!',
	'PCOI_SAVED'			=> 'Ayarlar başarıyla kaydedildi!.',
	'PCOI_UPDATED'			=> 'İndekste Gönderi Sayısı yapılandırması güncellendi.',
	
	'PCOI_ENABLE_EXPLAIN'	=> 'Eğer kapatırsanız gönderi sayıları aşağıda seçtiğiniz konumda <strong>gösterilmeyecek</strong>.',
	'PCOI_NAVBAR'			=> '<em>navbar</em>da göster?',
	'PCOI_FORUMLIST'		=> '<em>Forum listesi</em>nin üzerinde göster?',
	'PCOI_STATISTICS'		=> '<em>Site istatistiklerinde</em>lerinde göster?',
));
language/tr/common.php

Code: Select all

<?php
/**
*
* Post Count on Index. An extension for the phpBB Forum Software package.
*
* @copyright (c) 2018, Restless Rancor, https://www.restlessrancor.com
* @license GNU General Public License, version 2 (GPL-2.0)
*
*/
 
if (!defined('IN_PHPBB'))
{
	exit;
}
if (empty($lang) || !is_array($lang))
{
	$lang = array();
}
$lang = array_merge($lang, array(
	'USER_POSTS'	=> array(
		0	=> 'Hiç gönderiniz yok.',
		1	=> '%d gönderiniz var.',
		2	=> '%d gönderiniz var!',
	),
));
Health For Everyone ==> www.saglikforum.org

User avatar
Restless Rancor
Registered User
Posts: 182
Joined: Tue Sep 18, 2018 1:51 pm

Re: [3.2][BETA] User's Post Count on Index

Post by Restless Rancor » Thu Nov 01, 2018 4:26 pm

Thanks, I'll get those added shortly and will be submitting for validation very soon.
These aren't the droids you're looking for...
My Extensions and Snippets (Ref link)

Post Reply

Return to “Extensions in Development”

Who is online

Users browsing this forum: Bing [Bot], cachete, Mannix_, sr55 and 34 guests