Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <?php
  2.  
  3. add_filter( 'gravityflow_search_criteria_status', 'jo_status_scenario_search_criteria', 10, 1 );
  4. function jo_status_scenario_search_criteria( $search_criteria ) {
  5.  
  6. if ( ! isset( $_SERVER['REQUEST_URI'] ) && strpos( strtolower( $_SERVER['REQUEST_URI'] ), '/status-check-64/' ) !== false ) {
  7. return $search_criteria;
  8. }
  9.  
  10. $current_user = wp_get_current_user();
  11. if ( ! $current_user->exists() ) {
  12. return $search_criteria;
  13. }
  14.  
  15. $search_criteria['field_filters']['mode'] = 'any';
  16. $search_criteria['field_filters'][] = array( 'key' => '6', 'value' => 'user_id|' . $current_user->ID );
  17.  
  18. return $search_criteria;
  19. }
  20.  
  21. add_filter( 'gravityflow_permission_granted_entry_detail', 'jo_status_scenario_permissions_check', 10, 4 );
  22. function jo_status_scenario_permissions_check( $permission_granted, $entry, $form, $current_step ) {
  23.  
  24. if ( ! isset( $_SERVER['REQUEST_URI'] ) && strpos( strtolower( $_SERVER['REQUEST_URI'] ), '/status-check-64/' ) !== false ) {
  25. return $permission_granted;
  26. }
  27.  
  28. if ( $form['id'] != '64' ) {
  29. return $permission_granted;
  30. }
  31.  
  32. $current_user = wp_get_current_user();
  33. if ( ! $current_user->exists() ) {
  34. return $permission_granted;
  35. }
  36.  
  37. if ( $entry['6'] == 'user_id|' . $current_user->ID ) {
  38. return true;
  39. }
  40.  
  41. return $permission_granted;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement