How to integrete viewtopic pagetitle rewrited to Extension?

Discussion forum for Extension Writers regarding Extension Development.
dkone164
Registered User
Posts: 95
Joined: Thu Jan 20, 2011 11:20 pm

How to integrete viewtopic pagetitle rewrited to Extension?

Post by dkone164 »

Hello,

I have changed pagletitle in the file viewtopic.php like this :

Code: Select all

$page_title = $topic_data['topic_title'] . ' - ' . $topic_data['forum_name'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], $pagination->get_on_page($config['posts_per_page'], $start)) : '');
and i have changed the next code in the file /include/functions_messenger.php to stop to be blocked by Yahoo

Code: Select all

$result = $config['email_function_name']($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers, "-f" . $config['board_email']); 
How to integrate this two to an extension?
Last edited by dkone164 on Tue Nov 25, 2014 7:48 pm, edited 1 time in total.
alf007
Registered User
Posts: 36
Joined: Sun Mar 13, 2005 5:46 pm
Location: France (78)

Re: How to integrete viewtopic pagetitle rewrited to Extension?

Post by alf007 »

If you have a look in the phpbb code in viewtopic.php (line 2116 for 3.1.1), you can see you could use in an Extension the event 'core.viewtopic_modify_page_title' triggered just after the definition of the page title, and so modify it like you was doing as mod.

For the second part, i don't know what was the phpbb original code, so can't find it. Try to search in the new version. And look for an event trigger like above.
dkone164
Registered User
Posts: 95
Joined: Thu Jan 20, 2011 11:20 pm

Re: How to integrete viewtopic pagetitle rewrited to Extension?

Post by dkone164 »

Thanks,
for the second the root code is

Code: Select all

$result = $config['email_function_name']($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true
marcovo
Registered User
Posts: 239
Joined: Fri Nov 16, 2012 12:19 pm
Location: The Netherlands
Name: Marco

Re: How to integrete viewtopic pagetitle rewrited to Extension?

Post by marcovo »

You seem to be referring to the function phpbb_mail() in /includes/functions_messenger.php . There is no event present in this function, so you can't use the events present in phpBB3.1.1 to achieve the change you're looking for. However, you can request an event if you want to.

If you don't want to request an event, and your extension is only for private use (e.g. not intended for publishing), I suggest reading this topic after an answer has been given there. I have found it helpful to inject my own code like I do there, but I'm not 100% sure whether it's quite a good idea. :P
dkone164
Registered User
Posts: 95
Joined: Thu Jan 20, 2011 11:20 pm

Re: How to integrete viewtopic pagetitle rewrited to Extension?

Post by dkone164 »

Hello,

Thanks, i asked a new Event.

Else to integrete viewtopic pagetitle:

Code: Select all

  public function  viewtopic_modify_page_title($event)
	{  
  $page_title = $event['page_title'];   
  $page_title2 = str_replace($event['topic_data']['topic_title'], $event['topic_data']['topic_title']. ' - ' . $event['topic_data']['forum_name'], $page_title);
  $event['page_title'] = $page_title2;
	}   

Return to “Extension Writers Discussion”