Page 2 of 2

Re: [INFO] Extensions New ACP Module Auth

Posted: Thu Mar 06, 2014 4:23 pm
by VSE
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).

Re: [INFO] Extensions New ACP Module Auth

Posted: Thu Mar 06, 2014 8:49 pm
by tbackoff
Thanks Matt, I'll give that a try tonight.

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

Posted: Sun Aug 31, 2014 10:32 am
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?

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

Posted: Sun Aug 31, 2014 10:39 am
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?

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

Posted: Sun Aug 31, 2014 7:38 pm
by VSE
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

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

Posted: Wed Jan 21, 2015 1:05 pm
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?

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

Posted: Wed Jan 21, 2015 6:47 pm
by VSE
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.

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

Posted: Wed Jan 21, 2015 8:15 pm
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.

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

Posted: Fri Jan 23, 2015 1:11 pm
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.

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

Posted: Fri Jan 23, 2015 1:46 pm
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

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

Posted: Fri Jan 23, 2015 1:58 pm
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

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

Posted: Fri Jan 23, 2015 3:09 pm
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.

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

Posted: Fri Jan 23, 2015 3:52 pm
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 :)

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

Posted: Fri Jan 23, 2015 7:13 pm
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'),
				),
			)),
		);
	}
}