Confirmation message in custom quicktool

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The next feature release of phpBB 3 will be 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.2.x. If you need support for phpBB 3.2.x please visit the 3.2.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
Hunchman801
Registered User
Posts: 14
Joined: Fri Sep 11, 2015 12:55 pm

Confirmation message in custom quicktool

Post by Hunchman801 » Sun Oct 25, 2015 8:53 pm

After running a custom quicktool action you might want to display a confirmation message just like in the default ones:

Code: Select all

trigger_error($user->lang['USER_POSTS_MOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));
However it seems that the module's u_action is not accessible from within the event.

An easy fix would be to add it to the event variables:
includes/acp/acp_users.php
Change:

Code: Select all

default:
	/**
	* Run custom quicktool code
	*
	* @event core.acp_users_overview_run_quicktool
	* @var	array	user_row	Current user data
	* @var	string	action		Quick tool that should be run
	* @since 3.1.0-a1
	*/
	$vars = array('action', 'user_row');
	extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_run_quicktool', compact($vars)));
break;
To:

Code: Select all

default:
	$u_action = $this->u_action;

	/**
	* Run custom quicktool code
	*
	* @event core.acp_users_overview_run_quicktool
	* @var	array	user_row	Current user data
	* @var	string	action		Quick tool that should be run
	* @since 3.1.0-a1
	*/
	$vars = array('action', 'user_row', 'u_action');
	extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_run_quicktool', compact($vars)));
break;
Any thoughts?

Note: of course you can use $this->request->variable('REQUEST_URI', '', false, \phpbb\request\request_interface::SERVER) but that's more of a hack than anything else.

User avatar
RMcGirr83
Registered User
Posts: 357
Joined: Fri Mar 09, 2007 1:51 am
Contact:

Re: Confirmation message in custom quicktool

Post by RMcGirr83 » Thu Nov 05, 2015 11:59 am

Do not hire Christian Bullock he won't finish the job and will keep your money

Hunchman801
Registered User
Posts: 14
Joined: Fri Sep 11, 2015 12:55 pm

Re: Confirmation message in custom quicktool

Post by Hunchman801 » Tue Dec 22, 2015 5:55 pm

I can see how you inject the action in the controller; it's easily done by setting it in from the module.

Not sure how to make the listener aware of it though.

Post Reply