[Dev-Change] Extensions New ACP/UCP/MCP Module Auth

Discussion forum for Extension Writers regarding Extension Development.
User avatar
MattF
Extensions Development Coordinator
Extensions Development Coordinator
Posts: 5186
Joined: Sat Jan 17, 2009 9:37 am
Location: Los Angeles, CA
Name: Matt Friedman
Contact:

Re: [INFO] Extensions New ACP Module Auth

Post by MattF »

John P wrote:I tried this this morning, module_auth has a unique name ext_forumhulp/get_stuff, the extension isn't visible in ACP.
Permission set ext_forumhulp/get_stuff, extension is working but once disabled languageproblems and notices

Module_auth ext_forumhulp/get_stuff || acl_a_board, extension is visible and working, once disabled languageproblems and notices


The problems comes from the disable extension function, it only updates the extension table and not the module table. So either set module_enabled to false when disabling or look also at the extension table for ext_active in module management.
As I mentioned above, you are not using the latest build of the develop branch if you are experiencing that, in which case it won't work! You need to use the latest develop version of phpBB which supports this (or get the most recent nightly build).
Formerly known as VSEMy ExtensionsPlease do not PM me for support.
User avatar
tbackoff
Former Team Member
Posts: 7064
Joined: Thu Jun 04, 2009 1:41 am
Location: cheerleading practice
Name: Tabitha Backoff

Re: [INFO] Extensions New ACP Module Auth

Post by tbackoff »

Thanks Matt, I'll give that a try tonight.
Flying is the second best thrill to cheerleaders; being caught is the first.
Lord Le Brand
Registered User
Posts: 306
Joined: Fri May 26, 2006 8:28 pm
Location: The Netherlands (GMT+1)

Re: [INFO] Extensions New ACP/UCP/MCP Module Auth

Post by Lord Le Brand »

Hi.

Just wondering about this piece:
'filename'    => '\vendor\foobar\acp\foobar_module'
Is that for Windows based severs or also for *nix based servers, with the backslashes I mean?
Image
User avatar
david63
Registered User
Posts: 18102
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: [INFO] Extensions New ACP/UCP/MCP Module Auth

Post by david63 »

Lord Le Brand wrote:Hi.

Just wondering about this piece:
'filename'    => '\vendor\foobar\acp\foobar_module'
Is that for Windows based severs or also for *nix based servers, with the backslashes I mean?
That is for all servers - how would you know what type of server it was going to be run on?
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
MattF
Extensions Development Coordinator
Extensions Development Coordinator
Posts: 5186
Joined: Sat Jan 17, 2009 9:37 am
Location: Los Angeles, CA
Name: Matt Friedman
Contact:

Re: [INFO] Extensions New ACP/UCP/MCP Module Auth

Post by MattF »

This has nothing to do with servers. It's not a path to a file. That syntax has to do with PHP namespacing, and only works when the foobar_module class has a namespace defined at the top of it as vendor\foobar\acp
Formerly known as VSEMy ExtensionsPlease do not PM me for support.
User avatar
BrokenCrust
Registered User
Posts: 68
Joined: Mon Feb 11, 2008 8:43 pm
Contact:

Re: [Dev-Change] Extensions New ACP/UCP/MCP Module Auth

Post by BrokenCrust »

I am converting an mod to an ext that adds a tab to the UCP.

I have the extension working. In the mod the module info file had the auth field set to and empty string. i.e.

Code: Select all

'auth' => '',
This is working fine in the ext except where the extension is disabled, because then it is still displayed in UCP (although the title loses its language translation). To fix this I tried to change the auth as detailed above to include

Code: Select all

'auth' => 'ext_vendor/foobar',
where this matches the ext details.

The extension installed correctly but throws an error when accessing the UCP page:-

Code: Select all

Parse error: syntax error, unexpected ')' in /html/forums/includes/functions_module.php(472) : eval()'d code on line 1
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5129: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions_module.php(472) : eval()'d code:1)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5129: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions_module.php(472) : eval()'d code:1)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 5129: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions_module.php(472) : eval()'d code:1)
I'm using 3.1.2

What am I doing wrong?
User avatar
MattF
Extensions Development Coordinator
Extensions Development Coordinator
Posts: 5186
Joined: Sat Jan 17, 2009 9:37 am
Location: Los Angeles, CA
Name: Matt Friedman
Contact:

Re: [Dev-Change] Extensions New ACP/UCP/MCP Module Auth

Post by MattF »

According to the error, you may have added a parenthesis to your extension name. Check your code for stray parenthesis.

I have used this before with the UCP and extensions and it has always worked fine here.
Formerly known as VSEMy ExtensionsPlease do not PM me for support.
User avatar
BrokenCrust
Registered User
Posts: 68
Joined: Mon Feb 11, 2008 8:43 pm
Contact:

Re: [Dev-Change] Extensions New ACP/UCP/MCP Module Auth

Post by BrokenCrust »

Thanks. The only difference between the two is the line above. In fact if I put any value in there I get this error except when I put

Code: Select all

something && something
then I get an error about an extra &.

It can't be an extra ) because there isn't one, either in the name or in the file. I must be doing something wrong with the auth setting but I can't understand where.
User avatar
BrokenCrust
Registered User
Posts: 68
Joined: Mon Feb 11, 2008 8:43 pm
Contact:

Re: [Dev-Change] Extensions New ACP/UCP/MCP Module Auth

Post by BrokenCrust »

I'm still not getting anywhere with this. :cry:

Does anyone have a working example of adding a tab to the UCP in an extension with the correct auth settings? I searched about but couldn't find an extension that did this but I expect I missed them.
User avatar
Wolfsblvt
Registered User
Posts: 634
Joined: Sun Oct 26, 2014 9:12 pm
Location: Solingen, Germany
Contact:

Re: [Dev-Change] Extensions New ACP/UCP/MCP Module Auth

Post by Wolfsblvt »

I don't know of any extensions there.
There are just some extensions wich added ucp settings into an existing tab.
So maybe no one has done that yet? :D
If you have a specific extension request and you are willing to pay for, you can write me a PM.
My extensions (Trending: @Mention SystemAdvanced PollsUser Online Time)

»Du kamst zu uns. Deine Stimme kam. Du zeigtest uns die Sterne. Sie funkelten. Wir konnten sehen.«
User avatar
david63
Registered User
Posts: 18102
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Contact:

Re: [Dev-Change] Extensions New ACP/UCP/MCP Module Auth

Post by david63 »

BrokenCrust wrote:Does anyone have a working example of adding a tab to the UCP in an extension with the correct auth settings? I searched about but couldn't find an extension that did this but I expect I missed them.
I thought that your "Delete my Account" extension did just that
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
BrokenCrust
Registered User
Posts: 68
Joined: Mon Feb 11, 2008 8:43 pm
Contact:

Re: [Dev-Change] Extensions New ACP/UCP/MCP Module Auth

Post by BrokenCrust »

david63 wrote:I thought that your "Delete my Account" extension did just that
Ha ha. Yes it does. And it works correctly, except as described above. i.e. putting something in auth='' breaks the ext. I am trying to understand why and can not. I am therefore asking if someone else did it successfully for a UCP module and can show me that so I can use it to work out what I did wrong. The official extensions have ACP modules and my code matches those, but there is no UCP example and I'm thinking that it might be different or that there is perhaps a bug for UCP modules or I made some stupid error and can't see it yet.
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 26367
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Re: [Dev-Change] Extensions New ACP/UCP/MCP Module Auth

Post by Paul »

BrokenCrust, it helps if you provide the code which you are using (On github or somewhere else), then we can see what you are doing wrong easier :)
Knock knock
Race condition
Who's there?

My BlogMy Photosmy phpBB Extensionscustom phpBB work & Development
User avatar
BrokenCrust
Registered User
Posts: 68
Joined: Mon Feb 11, 2008 8:43 pm
Contact:

Re: [Dev-Change] Extensions New ACP/UCP/MCP Module Auth

Post by BrokenCrust »

Well, you have my code for review [hint hint] so help yourself, but yes I must try to learn github (I'm an SVN :D ). These are the two files in question I expect. It works like this, but not with a non empty string for auth.

Code: Select all

namespace brokencrust\deletemyaccount\ucp;

class delete_my_account_info
{
	function module()
	{
		return array(
			'filename'	=> '\brokencrust\deletemyaccount\ucp\delete_my_account_module',
			'title'		=> 'UCP_DELETE_MY_ACCOUNT',
			'modes'		=> array(
				'delete_my_account'	=> array('title' => 'UCP_DELETE_MY_ACCOUNT', 'auth' => '', 'cat' => array('UCP_DELETE_MY_ACCOUNT')),
			),
		);
	}
}

Code: Select all

namespace brokencrust\deletemyaccount\migrations\v10x;

/**
* Migration stage 2: Initial module
*/
class m2_initial_module extends \phpbb\db\migration\migration
{
	/**
	* Add or update data in the database
	*
	* @return array Array of table data
	* @access public
	*/
	public function update_data()
	{
		return array(
			array('module.add', array('ucp', '', 'UCP_DELETE_MY_ACCOUNT')),
			array('module.add', array(
				'ucp', 'UCP_DELETE_MY_ACCOUNT', array(
					'module_basename' => '\brokencrust\deletemyaccount\ucp\delete_my_account_module',
					'modes'           => array('delete_my_account'),
				),
			)),
		);
	}
}
Post Reply

Return to “Extension Writers Discussion”