mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
[ticket/12371] Allow notification types to redirect to a different url
This way we can redirect the post and bookmark notification to the first unread post in the topic PHPBB3-12371
This commit is contained in:
parent
ed40846590
commit
e0fadfb4d6
4 changed files with 24 additions and 1 deletions
|
@ -63,7 +63,7 @@ if (($mark_notification = $request->variable('mark_notification', 0)))
|
||||||
redirect(append_sid($phpbb_root_path . $redirect));
|
redirect(append_sid($phpbb_root_path . $redirect));
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect($notification->get_url());
|
redirect($notification->get_redirect_url());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,6 +275,14 @@ abstract class base implements \phpbb\notification\type\type_interface
|
||||||
return $this->mark(true, $return);
|
return $this->mark(true, $return);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {inheritDoc}
|
||||||
|
*/
|
||||||
|
public function get_redirect_url()
|
||||||
|
{
|
||||||
|
return $this->get_url();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare to output the notification to the template
|
* Prepare to output the notification to the template
|
||||||
*
|
*
|
||||||
|
|
|
@ -269,6 +269,14 @@ class post extends \phpbb\notification\type\base
|
||||||
return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "p={$this->item_id}#p{$this->item_id}");
|
return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "p={$this->item_id}#p{$this->item_id}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {inheritDoc}
|
||||||
|
*/
|
||||||
|
public function get_redirect_url()
|
||||||
|
{
|
||||||
|
return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "t={$this->item_parent_id}&view=unread#unread");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Users needed to query before this notification can be displayed
|
* Users needed to query before this notification can be displayed
|
||||||
*
|
*
|
||||||
|
|
|
@ -98,6 +98,13 @@ interface type_interface
|
||||||
*/
|
*/
|
||||||
public function get_url();
|
public function get_url();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the url to redirect after the item has been marked as read
|
||||||
|
*
|
||||||
|
* @return string URL
|
||||||
|
*/
|
||||||
|
public function get_redirect_url();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL to unsubscribe to this notification
|
* URL to unsubscribe to this notification
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue