[PHP] core.ucp_pm_compose_predefined_message

Request hook events and what data needs to be sent for the new hook system.
Post Reply
KillBill.
Registered User
Posts: 20
Joined: Wed Feb 11, 2015 6:07 am

[PHP] core.ucp_pm_compose_predefined_message

Post by KillBill. »

  • Identifer: core.ucp_pm_compose_predefined_message
    Location: includes/ucp/ucp_pm_compose.php
    Parameters: $message_text, $message_subject
    Explanation: phpBB Arcade reported bug games - reply
Example:

Code: Select all

		$message_text = $message_subject = '';

		$vars = array(
			'message_text',
			'message_subject',
		);
		extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_predefined_message', compact($vars)));
Ticket :: https://tracker.phpbb.com/browse/PHPBB3-13605

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: [PHP] core.ucp_pm_compose_predefined_message

Post by nickvergessen »

Can you please (for all of your requests) state what you want to do, and maybe post some example code?
Your given explanations are not very helpful to see what you want to do, so we can't tell you whether you can use another already existing event for that.
Member of the Development-TeamNo Support via PM

KillBill.
Registered User
Posts: 20
Joined: Wed Feb 11, 2015 6:07 am

Re: [PHP] core.ucp_pm_compose_predefined_message

Post by KillBill. »

nickvergessen wrote:Can you please (for all of your requests) state what you want to do, and maybe post some example code?
Your given explanations are not very helpful to see what you want to do, so we can't tell you whether you can use another already existing event for that.
Want to achieve substantially similar as the "quotepost"

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: [PHP] core.ucp_pm_compose_predefined_message

Post by nickvergessen »

Well we don't need

Code: Select all

      $message_text = $message_subject = '';

      $vars = array(
         'message_text',
         'message_subject',
      );
      extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_predefined_message', compact($vars)));
But the code you want to run there, so we can see whether it actually makes sense like that.
Member of the Development-TeamNo Support via PM

KillBill.
Registered User
Posts: 20
Joined: Wed Feb 11, 2015 6:07 am

Re: [PHP] core.ucp_pm_compose_predefined_message

Post by KillBill. »

example::

Code: Select all

	public function pm_compose($event)
	{
		if ($game_report_id = (int) request_var('rid', 0))
		{
			global $arcade;
			$message_subject = $message_text = '';
			$arcade->pm_quote('report', $game_report_id, $message_subject, $message_text);
			$event['message_subject'] = $message_subject;
			$event['message_text'] = $message_text;
		}
	}
$arcade->pm_quote function

Code: Select all

	function pm_quote($mode, $id, &$subject, &$message)
	{
		global $db, $config, $phpEx;

		switch ($mode)
		{
			case 'report':
				$sql = 'SELECT r.game_id, r.report_desc, r.report_desc_uid AS bbcode_uid, g.game_name, u.username AS quote_username, u.user_lang
						FROM ' . ARCADE_REPORTS_TABLE . ' r, ' . ARCADE_GAMES_TABLE . ' g, ' . USERS_TABLE . ' u
						WHERE r.report_id = ' . (int) $id . '
							AND r.game_id = g.game_id
							AND r.user_id = u.user_id';
						$result = $db->sql_query($sql);
				$game_report = $db->sql_fetchrow($result);
				$db->sql_freeresult($result);

				if ($game_report)
				{
					$reported_game = $this->message_language($game_report['user_lang'], 'ARCADE_REPORTED_GAME');

					if ($config['allow_post_links'])
					{
						$game_link = "[url=" . generate_board_url() . "/arcade.$phpEx?mode=play&g={$game_report['game_id']}" . $this->gametop . "]{$reported_game}: {$game_report['game_name']}[/url]\n";
					}
					else
					{
						$game_link = $reported_game . ': ' . $game_report['game_name'] . " (" . generate_board_url() . "/arcade.$phpEx?mode=play&g={$game_report['game_id']}" . $this->gametop . ")\n";
					}

					decode_message($game_report['report_desc'], $game_report['bbcode_uid']);

					$subject = 'Re: ' . $reported_game . '-' . $game_report['game_name'];
					$message = $game_link . (($game_report['report_desc']) ? "\n[quote="{$game_report['quote_username']}"]" . censor_text(trim($game_report['report_desc'])) . "[/quote]\n" : '');
				}
			break;

Post Reply