[CDB] Smartfeed 3.0.4

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)
User avatar
david63
Registered User
Posts: 17988
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: [BETA] Smartfeed 3.0.1

Post by david63 »

I may be wrong but I am fairly sure that I have read somewhere that constants should go in the ext.php file.
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
RMcGirr83
Recognised Extension Developer
Posts: 21172
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [BETA] Smartfeed 3.0.1

Post by RMcGirr83 »

david63 wrote:I may be wrong but I am fairly sure that I have read somewhere that constants should go in the ext.php file.
They should go there because?
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions | My extensions are updated regularly on github
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored
User avatar
3Di
Former Team Member
Posts: 15742
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [BETA] Smartfeed 3.0.1

Post by 3Di »

david63 wrote:I may be wrong but I am fairly sure that I have read somewhere that constants should go in the ext.php file.
You are right, so did I.
But there are no reasons to do that, expecially because the ext.php file already has its own purpose: https://wiki.phpbb.com/Developing_Extensions#ext.php .

Also, I don't see the need to create a folder/dir where to put that constants.php file.

Here it is how I am using it, instead.
The constants.php file lies into the ext_root just like ext.php (in case we would like to have more constants files then I do agree with Rich it could be better to create a folder though)

My constants.php file

Code: Select all

<?php
/**
*
* @package Online Since
*
* @copyright (c) 2015 3Di (v103 - 14-10-2015)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

namespace threedi\onlinesince;

/**
* Extension class for custom constants
*/

class constants
{
    const VERSION_ONLINESINCE = '1.0.3';
}
 
My listener.php file (excerpts)

Code: Select all

<?php
/**
*
* @package phpBB Extension - Online Since 1.0.3 - 14-10-2015
*
* @copyright (c) 2005-2008-2015 3Di
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

namespace threedi\onlinesince\event;

/**
* @ignore
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

use threedi\onlinesince\constants;

/**
* Event listener
*/
class listener implements EventSubscriberInterface

// ..... all the rest here and now I use it

        $this->template->assign_vars(array(
        'VERSION_ONLINESINCE'        => constants::VERSION_ONLINESINCE,
 
Now I am able to "use" it. Like I above said, everywhere.
Also Rich pointed to the usecase http://stackoverflow.com/a/23793236 (in case you are using a folder/dir) ;)

Sorry Mark, I was a little bit tired tonight and I pointed you to the Titania "ext", my fault, like somebody else already said it is not a good example, being itself an "hybrid" somehow. ;)

I hope everything is clear and I helped you (like the other guys) a little bit.

regards.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
:studio_microphone: Looking for a specific feature or alternative option?
User avatar
david63
Registered User
Posts: 17988
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: [BETA] Smartfeed 3.0.1

Post by david63 »

RMcGirr83 wrote:
david63 wrote:I may be wrong but I am fairly sure that I have read somewhere that constants should go in the ext.php file.
They should go there because?
nicofuma said so here - viewtopic.php?f=461&t=2339861&p=1422824 ... #p14228241
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
RMcGirr83
Recognised Extension Developer
Posts: 21172
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [BETA] Smartfeed 3.0.1

Post by RMcGirr83 »

david63 wrote:nicofuma said so here - viewtopic.php?f=461&t=2339861&p=1422824 ... #p14228241
He said to "just" add it there....not that it was a requirement for them to be defined in that file. Further he also said this
Don't store your extension version number in the database.
which seems to be speaking of version numbering?

I don't believe there is any documentation stating that constants HAVE to be defined within the ext.php file. Many extensions won't even require the use of an ext.php file.

These last few posts seem to be more appropriate in extension writers than within this topic so maybe a moderator can split the posts and we can discuss further without cluttering this topic.
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions | My extensions are updated regularly on github
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored
User avatar
MarkDHamill
Registered User
Posts: 4220
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [BETA] Smartfeed 3.0.1

Post by MarkDHamill »

RMcGirr83, thank you, this worked like a charm. I do like to understand these things and I don't understand why the last solution didn't work. I assume it's some sort of conflicting namespace thing.

When do you add extends \phpbb\extension\base to a class?
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Kindle and paper versions available.
User avatar
RMcGirr83
Recognised Extension Developer
Posts: 21172
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [BETA] Smartfeed 3.0.1

Post by RMcGirr83 »

When do you add extends \phpbb\extension\base to a class?
Not sure myself...still learning. As far as I can tell, and probably incorrectly at that, the base is constructed with dependencies such as symfony's ContainerInterface. Take a look at the base.php file found in phpbb/extension directory.

As far as to why your last solution didn't work, it is probably some symfony thing which I haven't completely got my head around yet.

If you had created a constants.php file within the root directory of your extension eg,

Code: Select all

<?php
/**
*
* @package phpBB Extension - Smartfeed
* @copyright (c) 2015 Mark D. Hamill (mark@phpbbservices.com)
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace phpbbservices\smartfeed;


class constants
{
     const BLAH = '1';
}
and then used that in the listener file

use phpbbservices\smartfeed\constants;

You should have been able to then use the constants defined constants::BLAH
In times of change, learners inherit the earth, while the learned find themselves beautifully equipped to deal with a world that no longer exists - Eric Hoffer
Former Modifications/Extensions Team Member | My extensions | My extensions are updated regularly on github
Appreciate the extensions/mods/support then buy me a beer
All requests for support via PM will be ignored
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 26285
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: [BETA] Smartfeed 3.0.1

Post by Paul »

The reason why it didn't work at first was because there was no namespace declaration ;). Without namespace declaration it is in the global namespace, and not in what you tried to use.

In my opinion ext.php should not contain constants. You should create a seperate file for it. Yon don't need to extent it from base.php, that only applies to ext.php.
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development
User avatar
MarkDHamill
Registered User
Posts: 4220
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [BETA] Smartfeed 3.0.1

Post by MarkDHamill »

Thanks to all who replied. I will keep the constants in /constants/constants.php file. I don't have an ext.php file anymore so I think that issue is moot.

I think I now understand the extensions architecture enough to start the digests extension, which will be a relief to that community which won't upgrade to 3.1 until I finish it. Smartfeed is easier to get my head around as it is less complex.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Kindle and paper versions available.
User avatar
3Di
Former Team Member
Posts: 15742
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [BETA] Smartfeed 3.0.1

Post by 3Di »

Well, glad you got it working.

One more €cent to spend: we are using now, a kind of user interface, phpBB3.1 works under the Symfony2 framework and there is a lot to discover there, still... for us.

For example the constants could also be defined and widely used (also in templates, uses Twig!) simply with a config.yml file, like pointed out into the first answer of this link: http://stackoverflow.com/q/23790171

Docs here:
https://symfony.com/doc/current/best_pr ... ation.html
https://symfony.com/doc/current/cookboo ... ments.html

Anyway, this can be discussed furthermore but elsewhere, here in this Forum.
I wish you all the best.
Regards.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
:studio_microphone: Looking for a specific feature or alternative option?
User avatar
MarkDHamill
Registered User
Posts: 4220
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC1] Smartfeed 3.0.2

Post by MarkDHamill »

I spent the last couple of days tediously going through all my Smartfeed test cases in preparation for Release Candidate 1, which I published today and you can download for testing. It's a good thing because if you look at the changes on GitHub you will see lots of bugs were found and fixed. Please test it thoroughly and provide feedback. Of course I adopted a lot of the suggestions from developers in this topic. I appreciate these as it is definitely improving the product.

Download here

GitHub Smartfeed tree
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Kindle and paper versions available.
pantherfan
Registered User
Posts: 44
Joined: Thu Nov 12, 2015 12:15 am
Name: Tangela

Re: [RC1] Smartfeed 3.0.2

Post by pantherfan »

Where are the permissions for this extension located?
User avatar
MarkDHamill
Registered User
Posts: 4220
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA
Contact:

Re: [RC1] Smartfeed 3.0.2

Post by MarkDHamill »

Not sure what you mean, but there are no special permissions that get set in installation. Smartfeed can be used for public feeds and for private feeds (i.e. ability to access protected forums). The extension will read your existing forum permissions to figure out what you can access.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Kindle and paper versions available.
pantherfan
Registered User
Posts: 44
Joined: Thu Nov 12, 2015 12:15 am
Name: Tangela

Re: [RC1] Smartfeed 3.0.2

Post by pantherfan »

Hmm. When I click on smartfeed, it says, "Sorry, due to your user status you cannot access any forums", even though I am the administrator, and can access all of them.
User avatar
david63
Registered User
Posts: 17988
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: [RC1] Smartfeed 3.0.2

Post by david63 »

pantherfan wrote:I am the administrator, and can access all of them.
By default an Administrator does not have access to anything other than the ACP - access to fora is a user/moderator permission
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
Locked

Return to “Extensions in Development”