eventsmanager

Location Is Logged-in conditional placeholder

Dec 18th, 2017
145
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. * This snippet will allow users to use {logged_in} #_LOCATIONNOTES {/logged_in}
  3. */
  4. add_action('em_location_output_show_condition', 'my_em_location_isloggedin_output_placeholder', 1, 4);
  5. function my_em_location_isloggedin_output_placeholder($replacement, $condition, $match, $EM_Location){
  6.  
  7. if( is_object($EM_Location) && preg_match('/^logged_in$/',$condition, $matches) ){
  8.  
  9. if( is_user_logged_in() ){
  10. $replacement = preg_replace("/\{\/?$condition\}/", '', $match);
  11. }else{
  12. $replacement = '';
  13. }
  14.  
  15. }
  16.  
  17. return $replacement;
  18. }
RAW Paste Data