• Resolved F C

    (@pmagony)


    Hola Amigos,

    Is there anyway to modify the code on the footer link, so that when it is clicked, it redirects you to the Users page instead of the Current URL?

    public function action_wp_footer() {
    
    		if ( ! did_action( 'wp_meta' ) && ! is_admin_bar_showing() && $old_user = self::get_old_user() ) {
    			/* Translators: 1: user display name; 2: username; */
    			$link = sprintf( __( 'Switch back to %1$s (%2$s)', 'user-switching' ), $old_user->display_name, $old_user->user_login );
    			$url = add_query_arg( array(
    				'redirect_to' => urlencode( self::current_url() ),
    			), self::switch_back_url( $old_user ) );
    			echo '<p id="user_switching_switch_on"><a href="' . esc_url( $url ) . '">' . esc_html( $link ) . '</a></p>';
    		}
    
    	}
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter F C

    (@pmagony)

    Disregard, I figured it out. If you want to redirect the footer link to the admin areas Users page, so the admin can switch to another user, in /plugins/user-switching/user-switch.php modify lines 464 through 467 with the following:

    `public function action_wp_footer() {

    if ( ! did_action( ‘wp_meta’ ) && ! is_admin_bar_showing() && $old_user = self::get_old_user() ) {
    /* Translators: 1: user display name; 2: username; */
    $link = sprintf( __( ‘Switch back to %1$s (%2$s)’, ‘user-switching’ ), $old_user->display_name, $old_user->user_login );
    $url = add_query_arg( array(
    // ‘redirect_to’ => urlencode( self::current_url() ),
    ‘redirect_to’ => urlencode( “https://www.yourdoman.com/wp-admin/users.php&#8221; ),
    ), self::switch_back_url( $old_user ) );
    echo ‘<p id=”user_switching_switch_on”><a href=”‘ . esc_url( $url ) . ‘”>’ . esc_html( $link ) . ‘</a></p>’;
    }

    }`

    Be sure to update the redirect URL to your domain.

    Thread Starter F C

    (@pmagony)

    Also, the following CSS styles will help if you are running a custom theme, just dump to your styles.css and upload:

    
    #user_switching_switch_on {position:absolute; top:80px; left:80px; z-index:100000000;}
    #user_switching_switch_on a {font-size:16px; color:red; font-weight:bold;}
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Redirect to Users Page Instead of Current URL?’ is closed to new replies.