Skip to content

Commit

Permalink
add hook to disable sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
Viorel committed Jun 11, 2018
1 parent 1c9b7c5 commit 1238825
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion framework/helpers/class-fw-session.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/
class FW_Session {
private static function start_session() {
if ( ! session_id() ) {
if ( apply_filters( 'fw_use_sessions', true ) && ! session_id() ) {
session_start();
}
}
Expand Down
4 changes: 3 additions & 1 deletion framework/includes/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function _action_fw_form_frontend_default_styles() {
* @internal
*/
function _action_fw_flash_message_backend_prepare() {
if ( ! session_id() ) {
if ( apply_filters( 'fw_use_sessions', true ) && ! session_id() ) {
session_start();
}
}
Expand All @@ -242,6 +242,8 @@ function _action_fw_flash_message_backend_prepare() {
*/
function _action_fw_flash_message_frontend_prepare() {
if (
apply_filters( 'fw_use_sessions', true )
&&
/**
* In ajax it's not possible to call flash message after headers were sent,
* so there will be no "headers already sent" warning.
Expand Down

0 comments on commit 1238825

Please sign in to comment.