The MU forums have moved to WordPress.org

How to pull 'Biographical Info'? (9 posts)

  1. boonika
    Member
    Posted 11 years ago #

    <div id="sidebar">
    		<ul id="sidelist">
    
    			<li id="abouttext">
    			<h2>Services:</h2> <?php
    function print_profile() {
           global $wp_query, $blogownerid;
           global $wpdb, $blog_id;
    	$blogownerid = $wpdb->get_var("SELECT post_author FROM wp_" . $blog_id . "_posts");
    $userdata = get_userdata($blogownerid);
     if ($userdata->description != '') {
    echo substr($userdata->description, 0, 180); }
    }
    echo print_profile(); ?>
    				<div id="hire"><a href="http://boonika.net/contact/hire/" target="_blank">Hire <?php bloginfo('name'); ?></a></div>
    </li>
    
    	<?php 	/* Widgetized sidebar, if you have the plugin installed. */
    					if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    		<?php endif; ?>
    
    </ul><!--END SIDELIST-->
    </div><!--END SIDEBAR-->

    This is how sidebar for new created blogs looks like. I adjusted it to pull 'Biographical Info' which you can edit inside 'Edit User' area. Just like you can see here on my portfolio: http://marko.boonika.net/

    After to 2.8.6 upgrade it wont show that info for newly created blogs: http://illustr8a.boonika.net/

    But, as you can see on my portfolio, old blogs stayed untouched.

  2. DeannaS
    Member
    Posted 11 years ago #

    instead of doing an echo of the description, do a var_dump($userdata). See what you've got in there. Is it different between old and new users?

  3. boonika
    Member
    Posted 11 years ago #

    If you are talking about the code than no, it is the same default theme.

  4. DeannaS
    Member
    Posted 11 years ago #

    No, I'm saying change your function in the code you posted.

    function print_profile() {
           global $wp_query, $blogownerid;
           global $wpdb, $blog_id;
    	$blogownerid = $wpdb->get_var("SELECT post_author FROM wp_" . $blog_id . "_posts");
    $userdata = get_userdata($blogownerid);
     //if ($userdata->description != '') {
    //echo substr($userdata->description, 0, 180); }
    
    var_dump($userdata);
    }

    See what you're getting back for user data.

  5. boonika
    Member
    Posted 11 years ago #

    Aha... sorry, I misunderstood this part 'Is it different between old and new users?'

    Thanks, will try your solution.

  6. boonika
    Member
    Posted 11 years ago #

    First, I don't think that I wrote it properly:

    var_dump($userdata->description, 0, 180); }

    Second, nothing changed on that last blog I created. Empty space, just like before.

  7. DeannaS
    Member
    Posted 11 years ago #

    No, I specifically DON'T want you to limit it to the description field. I want you to dump the entire variable (just like I wrote in the code). This is called debugging. This is how you solve problems. You dump out information so that you can look at it. This is not your ultimate solution. This is a step on the way to the solution.

  8. boonika
    Member
    Posted 11 years ago #

    Well, as one of your biggest admirer I can only say 'thank you'. But as a designer (wannabe programmer) who always fights with the code (ask andrear) I can only say 'these steps to final solution are too much for me at this moment but I will sure investigate it in following days'.

    Cheers,
    Marko

  9. DeannaS
    Member
    Posted 11 years ago #

    Okay, here's my take, having done the debugging for you. $userdata->description is not defined unless someone actually fills out their bio info. So, your new users haven't filled out their bio info.

    That's my take.

About this Topic