Forums

[Plugin: Profiler] Auto Linking to User Profiles (8 posts)

  1. Xnuiem
    Member
    Posted 3 years ago #

    Once you install this plugin, you may notice that the links throughout the program dont go to the new profile page. Here is how to fix this. Eric, please feel free to add it to the program if you would like.

    in profiler.php, add:

    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();
     	}
  2. jltidwell
    Member
    Posted 2 years ago #

    I'm pretty sure that's what I want to do, where in a post it says "Posted by: Backyard Grown" the link actually goes to the user's profile.

    If you can tell me where exactly to insert this code in the profile.php file I'll run right over and do it.

  3. jltidwell
    Member
    Posted 2 years ago #

    Help?

  4. Xnuiem
    Member
    Posted 2 years ago #

    It doesnt matter. Just as long as it is in <?php ?> it will be fine.

    Somewhere right after the headers probably makes it easy to find.

  5. starkey
    Member
    Posted 2 years ago #

    hello, i put this code everywhere but still nothing works, so can you explain relay slowly for dummy's where i must put it.
    maybe you miss some part?

  6. cde010
    Member
    Posted 2 years ago #

    was this resolved?

  7. ApocalypticTomorrow
    Member
    Posted 2 years ago #

    This seem like a cool concept plugin but it hasn't been updated in so long...

  8. jonperry
    Member
    Posted 2 years ago #

    Any way to make it so that their photo is click-able in there comments?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags