Support » Plugins » Showing Author Name for Recent Links plug-in

  • I’ve got a blog with multiple authors, and we just put in the Recent Links plugin. We’d like for the links to show which author wrote them, e.g.,
    LINK (by Matt)
    LINK (by Gordon)
    I’m halfway there, but I don’t know enough MySQL to get the rest of the way. I’ve got it to show author _numbers_, but not author _names_.
    I added the following to the plug-in:
    *added link_author to the SQL SELECT at the beginning of the plug-in. (link_author is already part of the recent links database).
    *added line:
    $link->link_author = stripslashes($link->link_author);
    to the relevant section, and
    *added line:
    $after = ‘(by ‘.wptexturize($link->link_author).’)’;
    immediately before the .out command. (Yeah, there’s probably a more aesthetic way to do it, but that worked pretty well).
    What that has gotten me is:
    LINK (by 4)
    LINK (by 5)
    Now, I think I need to get into another table of the database and somehow match up the author id to an author name. Actually doing that is beyond me right now. How exactly would I go about this? Thanks.
    (By the way, the site as currently stands is at http://www.timesandseasons.org . The recent links section is in the sidebar under the title “Bloggernacle Notes.” The direct link to that section is http://www.timesandseasons.org/wp/index.php#notes ).

Viewing 3 replies - 1 through 3 (of 3 total)
  • Well, I have gotten a working stopgap. Just before the output, I’ve dropped in:
    if (($link->link_author) == 5)
    {
    $nickname = ‘Kaimi Wenger’;
    }
    if (($link->link_author) == 4)
    {
    $nickname = ‘Matt Evans’;
    }
    I’m going to have to do that for every author, until I figure out how to get an SQL query to do it. I tried several variations of the basic idea:
    $nickname = mysql_query(“SELECT ID, user_nickname FROM $tableusers”)
    and couldn’t get it to work — my SQL skills are not very strong.
    I also tried:
    $nickname = “SELECT user_nickname FROM $tabelusers WHERE ID=”.$(link->link_author);
    but couldn’t make that work either. At the moment, I’m happy with my stopgap solution, but if anyone has any better ideas, I’m all ears.


    $resultSet = $wbpd->get_result("SELECT user_nickname FROM $tabelusers WHERE ID='$link->link_author'");
    echo( $resultSet[0]->user_nickname );

    Not at my install, but that should do the trick.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Showing Author Name for Recent Links plug-in’ is closed to new replies.