Advertisement
eventsmanager

Location Is Logged-in conditional placeholder

Dec 18th, 2017
761
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement