Skip to content

Commit

Permalink
AJAX without custom code
Browse files Browse the repository at this point in the history
  • Loading branch information
Flerex committed Jun 30, 2019
1 parent 0d27070 commit e61c26a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
14 changes: 7 additions & 7 deletions controller/switcher.php
Expand Up @@ -64,14 +64,12 @@ public function __construct(\phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\co
* Demo controller for route /switchaccount/{name}
*
* @param int $account_id
* @return \Symfony\Component\HttpFoundation\Response
* @throws \phpbb\exception\http_exception
*/
public function handle($account_id)
{

$redirect = $this->config['flerex_linkedaccounts_return_to_index']
? append_sid($this->phpbb_root_path . 'index.' . $this->phpEx)
: append_sid($this->user->data['session_page']);

if ($this->request->is_ajax())
{
Expand All @@ -96,10 +94,12 @@ public function handle($account_id)
'SUCCESS' => true,
);

if ($this->config['flerex_linkedaccounts_return_to_index'])
{
$data['REDIRECT'] = $redirect;
}
$data['REFRESH_DATA'] = [
'url' => $this->config['flerex_linkedaccounts_return_to_index']
? append_sid($this->phpbb_root_path . 'index.' . $this->phpEx)
: append_sid($this->user->data['session_page']),
'time' => 0,
];

$this->utils->switch_to_linked_account($account_id);
}
Expand Down
@@ -1,7 +1,4 @@
{% if switchable_account %}
{% if S_LINKEDACCOUNTS_AJAX %}
{% INCLUDEJS '@flerex_linkedaccounts/ajax.js' %}
{% endif %}
<li id="linked_accounts" class="bg1">
<ul>
{% for account in switchable_account %}
Expand Down
13 changes: 0 additions & 13 deletions styles/prosilver/theme/ajax.js

This file was deleted.

0 comments on commit e61c26a

Please sign in to comment.