pods_session_start

Safely start a new session (without whitescreening on certain hosts, which have no session path or isn't writable).

Description

pods_session_start(); 

Usage

  1. if ( !function_exists( 'pods_session_start' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'pods-custom-content-types-and-fields/includes/general.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = pods_session_start(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/includes/general.php  
  1. function pods_session_start() { 
  2.  
  3. $save_path = session_save_path(); 
  4.  
  5. // Check if headers were sent 
  6. if ( false !== headers_sent() ) { 
  7. return false; 
  8. // Allow for bypassing Pods session autostarting 
  9. elseif ( defined( 'PODS_SESSION_AUTO_START' ) && !PODS_SESSION_AUTO_START ) { 
  10. return false; 
  11. // Allow for non-file based sessions, like Memcache 
  12. elseif ( 0 === strpos( $save_path, 'tcp://' ) ) { 
  13. // This is OK, but we don't want to check if file_exists on next statement 
  14. // Check if session path exists and can be written to, avoiding PHP fatal errors 
  15. elseif ( empty( $save_path ) || !@file_exists( $save_path ) || !is_writable( $save_path ) ) { 
  16. return false; 
  17. // Check if session ID is already set 
  18. elseif ( '' != session_id() ) { 
  19. return false; 
  20.  
  21. // Start session 
  22. @session_start(); 
  23.  
  24. return true; 
  25.