Forums

[resolved] Link profiler with author (2 posts)

  1. dxbguy
    Member
    Posted 2 years ago #

    Hi all!

    I am trying to link my author's name with their profile on profiler. Have a look at my articles:

    http://associator.orange-technology.com/category/articles/

    As you can see, when you click the author name, it will only show all the stories by that author.

    At the top menu there is a button called profiles which lists all the users on the site with their profile.

    I want to link the authors with their profile. Anyone have any idea how to do this?

    http://wordpress.org/extend/plugins/profiler/

  2. dxbguy
    Member
    Posted 2 years ago #

    Ok nevermind, I just resolved this by adding this code to profiler.php

    if ($_GET["author"] || substr_count($_SERVER["REQUEST_URI"], "author")){
    	add_action('wp', 'pf_redirect');
    }
    
     	function pf_redirect(){
    		global $wpdb;
    
     		if ($_GET["author"]){
     			$user_name = $wpdb->get_var($wpdb->prepare("select user_login from " . $wpdb->prefix . "users where ID = %d limit 1", $_GET["author"]));
            }
            else if (substr_count($_SERVER["REQUEST_URI"], "author")){
            	if (substr($_SERVER["REQUEST_URI"], -1, 1) == "/"){
            		$uri = substr($_SERVER["REQUEST_URI"], 0, -1);
                }
                else {
                	$uri = $_SERVER["REQUEST_URI"];
                }
                $pos = strrpos($uri, "/");
            	$user_name = substr($uri, $pos + 1);
            }
    
     		$url = "/users?user=$user_name";
     		header("Location: $url");
     		exit();
     	}

Topic Closed

This topic has been closed to new replies.

About this Topic