rimpa

redirecting from dc-vendor-shipping to frontend shipping

May 18th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. add_action( 'template_redirect', 'vendor_template_overrides');
  2.  
  3. function vendor_template_overrides() {
  4. $pages = get_option("wcmp_pages_settings_name");
  5. if(!empty($pages)) {
  6. //rediect to admin dashboard
  7. if( is_user_logged_in() && is_vendor_page() && is_user_wcmp_vendor( get_current_user_id() ) ) {
  8.  
  9. if(is_page($pages['vendor_dashboard']) && && !current_user_can('administrator')) {
  10. if ( function_exists('admin_url') ) {
  11. $adminurl = admin_url();
  12. } else {
  13. $adminurl = get_admin_url();
  14. }
  15. wp_safe_redirect( $adminurl );
  16. exit();
  17. }
  18. }
  19. }
  20. }
  21.  
  22. function admin_vendor_shipping_redirect() {
  23. global $pagenow;
  24.  
  25. if($pagenow == 'admin.php' && isset($_GET['page']) && $_GET['page'] == 'dc-vendor-shipping'){
  26. wp_redirect(site_url('/wcmp_vendor_shipping/', 'http'));
  27. exit;
  28. }
  29. }
  30.  
  31. add_action('admin_init', 'admin_vendor_shipping_redirect');
Add Comment
Please, Sign In to add comment