Support » Plugin: Redirect Role Wise » Using Multi Roles

  • Resolved anymaa

    (@anymaa)


    Hi,

    I am trying this plugin with multi roles but, it’s take account of just primary role. How can i do this? I want to use second or third role.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter anymaa

    (@anymaa)

    Hi,

    You can update your code with this,

    In includes/front-end-redirection.php

    I added after 31. line

    
    $current_roles1 = $current_user->roles[1];
    $current_roles2 = $current_user->roles[2];
    $current_roles3 = $current_user->roles[3];
    $current_roles4 = $current_user->roles[4];
    

    And i added after 52. line

    
    if(in_array($current_roles1, $the_rrw_roles ))
    {	
    	$destination = $post->post_name;
            $destination_url = get_permalink($destination);
    	header("Location:".$destination_url); /* Redirect user */
    }
    if(in_array($current_roles2, $the_rrw_roles ))
    {	
    	$destination = $post->post_name;
    	$destination_url = get_permalink($destination);
    	header("Location:".$destination_url); /* Redirect user */
    }
    if(in_array($current_roles3, $the_rrw_roles ))
    {	
    	$destination = $post->post_name;
    	$destination_url = get_permalink($destination);
    	header("Location:".$destination_url); /* Redirect user */
    }
    if(in_array($current_roles4, $the_rrw_roles ))
    {	
            $destination = $post->post_name;
            $destination_url = get_permalink($destination);
    	header("Location:".$destination_url); /* Redirect user */
    }
    
    

    Now it can be read first 5 role by users.

    Thank you 🙂

    • This reply was modified 4 years, 11 months ago by anymaa.
    • This reply was modified 4 years, 11 months ago by anymaa.
    • This reply was modified 4 years, 11 months ago by anymaa. Reason: Misspelling
    Plugin Author Gyrix TechnoLabs

    (@priyankabhave)

    Hi @anymaa,
    Thanks for your inputs. I will add your code to my plugin and after testing it, I will upload the updated plugin.

    Thanks

    Plugin Author Gyrix TechnoLabs

    (@priyankabhave)

    Hi @anymaa,

    I have uploaded a new version of the plugin i.e 1.2, which gives the option for adding redirection rules for Multi-Roles users. Please update your site’s plugin and check if it works for you.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using Multi Roles’ is closed to new replies.