<a href="{t_block2.U_TITLE}"><span>{t_block2.L_TITLE}</span></a>
section in ucp_header.html.Code: Select all
static public function getSubscribedEvents()
{
return array(
'core.user_setup' => 'load_language',
'core.page_header' => 'build_url_top',
'core.page_header_after' => 'build_url_drafts',
'core.page_footer' => 'build_url_bookmarks',
'core.page_footer_after' => 'build_url_subscribed',
'core.obtain_users_online_string_modify' => 'build_url_attachments',
);
}
Code: Select all
'core.page_header' => 'build_url_top',
'core.page_header_after' => 'build_url_drafts,
'core.page_footer' => 'build_url_bookmarks',
'core.page_footer_after' => 'build_url_subscribed',
Code: Select all
<?php
/**
*
* @package welcome back
* @copyright (c) 2015 alex75 https://www.phpbb-store.it
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace alex75\welcomeback\event;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class listener implements EventSubscriberInterface
{
protected $user;
protected $template;
protected $root_path;
protected $phpEx;
protected $config;
public function __construct(
\phpbb\user $user,
\phpbb\config\config $config,
\phpbb\template\template $template,
$root_path,
$phpEx)
{
$this->user = $user;
$this->config = $config;
$this->template = $template;
$this->root_path = $root_path;
$this->phpEx = $phpEx;
}
static public function getSubscribedEvents()
{
return array(
'core.user_setup' => 'load_language',
'core.page_header' => 'build_url_top',
'core.page_header_after' => 'build_url_drafts',
'core.page_footer' => 'build_url_bookmarks',
'core.page_footer_after' => 'build_url_subscribed',
'core.obtain_users_online_string_modify' => 'build_url_attachments',
);
}
public function load_language($event)
{
$lang_set_ext = $event['lang_set_ext'];
$lang_set_ext[] = array(
'ext_name' => 'alex75/welcomeback',
'lang_set' => 'welcomebacklang',
);
$event['lang_set_ext'] = $lang_set_ext;
}
public function build_url_top($event)
{
$params = "author=" . $this->user->data['username'] . "&sf=firstpost&sr=topics";
$url = append_sid($this->root_path . "search." . $this->phpEx, $params);
$this->template->assign_vars(array(
'U_WBYOURTOPICS' => $url,
));
}
public function build_url_drafts($event)
{
$params = "i=ucp_main&mode=drafts";
$url = append_sid($this->root_path . "ucp." . $this->phpEx, $params);
$this->template->assign_vars(array(
'U_WBYOURDRAFTS' => $url,
));
}
public function build_url_subscribed($event)
{
$params = "i=ucp_main&mode=subscribed";
$url = append_sid($this->root_path . "ucp." . $this->phpEx, $params);
$this->template->assign_vars(array(
'U_WBYOURSUBSCRIBED' => $url,
));
}
public function build_url_bookmarks($event)
{
$params = "i=ucp_main&mode=bookmarks";
$url = append_sid($this->root_path . "ucp." . $this->phpEx, $params);
$this->template->assign_vars(array(
'U_WBYOURBOOKMARKS' => $url,
));
}
public function build_url_attachments($event)
{
$params = "i=ucp_attachments&mode=attachments";
$url = append_sid($this->root_path . "ucp." . $this->phpEx, $params);
$this->template->assign_vars(array(
'U_WBYOURATTACHMENTS' => $url,
));
}
}
Code: Select all
static public function getSubscribedEvents()
{
return array(
'core.user_setup' => 'load_language',
'core.page_header' => 'build_urls',
);
}
/**
* Execute code and/or overwrite page_header()
*
* @event core.page_header
*
* Synopsys: Template switches over all
*
* @return void
* @access public
*/
public function build_urls($event)
{
$url_1 = append_sid($this->root_path . 'search.' . $this->phpEx, 'author=' . $this->user->data['username'] . '&sf=firstpost&sr=topics');
$url_2 = blah;
//Etc etc
$this->template->assign_vars(array(
'U_WB_YOUR_TOPICS' => $url_1,
'U_WB_YOUR_DRAFTS' => $url_2,
'U_WB_YOUR_SUBSCRIBED' => $url_3,
'U_WB_YOUR_BOOKMARKS' => $url_4,
'U_WB_YOUR_ATTACHMENTS' => $url_5,
));
}