Forums

[resolved] Calling information from the database? (14 posts)

  1. Kahil
    Member
    Posted 2 years ago #

    OK, I have been searching both here and on the web for this and I can't find an answer for it....maybe I'm using the wrong search terms...

    But I can't figure out how to correctly call information from the database. Things like a username of the person who is logged in or profile information. I am wanting to display it in a section of a sidebar so that its only visible when that person is logged in. I just can't get it to work right. I've tried doing simple things like a cut and paste from wordpress files and plugins that do this in sections, but that doesn't work and I can't find any info that explains this.

    Thanks in advance.

    Kahil

  2. Kahil
    Member
    Posted 2 years ago #

    I thought that I might find something by reading up on some php stuff, but I had no luck there. Its like reading stereo instructions. I haven't been able to find anything that is easy to understand. I tried asking the person who made the plugin that I am working with, but all I got was the run-around.

    If anyone could help I would greatly appreciate it.

    Thank you!

  3. MichaelH
    moderator
    Posted 2 years ago #

    Author_Templates has some helpful information and Kaf's Get User Profile Plugin might give you ideas:
    http://guff.szub.net/2005/01/31/get-author-profile/

  4. Kahil
    Member
    Posted 2 years ago #

    I tried the author template stuff in two different themes and that didn't work. I was trying to place it in my sidebars and nothing showed up. I'm basically trying to do something similar as that plugin you suggested does, but I want to also show a person's avatar. I'm running the plugin called "simple forum". This plugin lets you have avatars that are supposed to be associated with your profile and can be called the same way. I have tried everything, but I can't get anything to show up and the plugin author will not help.

    thanks

  5. Kahil
    Member
    Posted 2 years ago #

    I just tried that plugin you suggested and it didn't even work... I followed the instructions to a tee and nothing shows up...

    EDIT:

    I was able to get it to work, but only by telling it which profile to display. I can't get it to display info based on whether or not the person visiting that page is logged in or not.

  6. doodlebee
    Member
    Posted 2 years ago #

    I use Dan's Avatar Thingy and the author template stuff mentioned above - works just fine.

    Have you tried disabling all of your plugins before using the Authors stuff?

  7. Kahil
    Member
    Posted 2 years ago #

    yeah, I even tried it on a fresh blog.

    What I am trying to do is call some of the same info that the "Simple Forum" plugin does. I know how to show or hide things based on whether or not someone is logged in, but I don't know how to call info from the database outside of the loop, like in the sidebar. I want to be able to display a person's avatar and basic info like name and some links in a section of my sidebar...

    Thanks

  8. doodlebee
    Member
    Posted 2 years ago #

    What kind of code were you using when you tried Michael's suggestion? Because I'm doing this on a client's site right now using the aforementioned plugin, and his "authors" stuff with no problem.

    Can you show us an example of the code you used?

  9. Kahil
    Member
    Posted 2 years ago #

    Here is what does work:

    <?php get_author_profile(1); ?>
    <div class="profile">
    
    <ul>
      <li id="myprofile">Blog Owner:
        </ul>
    <ul>
    <li><?php author_profile('firstname'); ?> <?php author_profile('lastname'); ?></li>
    <li>Jabber: <?php author_profile('jabber'); ?></li>
    <li>AIM: <?php author_profile('aim'); ?></li>
    <li>Notes: <?php author_profile('profile'); ?></li>
    </ul>
    </div>

    But that only shows my info, no matter who is logged in. I need it to be able to show whoever is logged in only. Say you logged in...it should only show your information, not mine or anyone elses...

  10. Kahil
    Member
    Posted 2 years ago #

    I've tried using things from the Author_Templates as suggested as well, but when placed outside of the loop, like the sidebar, you get nothing...

  11. doodlebee
    Member
    Posted 2 years ago #

    when placed outside of the loop, like the sidebar, you get nothing...

    Well, yeah. You *have* to use the Loop for it to know what to call in. (you are aware that you can use the Loop more than once, right? And you can put them anywhere you want to.)

  12. Kahil
    Member
    Posted 2 years ago #

    I just tried what was said and still couldn't get anything from the author_template stuff to show up. Does someone have a working example of this?

    With that profile plugin that was suggested, isn't it supposed to work and do these things outside of the loop? It seems to if you tell it to get info from a specific profile, but not based on whomever is logged in as is says it will do.

    Thanks

  13. Kahil
    Member
    Posted 2 years ago #

    i have been trying for a few hours now on this. I've used the loop in the sidebar and nothing works... Again, I can make it work to the point of specifying a specific user info to display, but not based on who is logged in. When I try anything along those lings that I have read, nothing shows up. I even tried just copying what the Simple Forum plugin has and nothing works... I even contacted the developer of that plugin and told me to just go learn php and gave me the run-around. All I asked was if he could give me an example of how I would be able to call the same profile info in my sidebar... :(

  14. Kahil
    Member
    Posted 2 years ago #

    Finally was able to get done what I was looking to do. I used a combo of the Simple Forum plugin and the Login Anywhere plugin. With some edits to their code, I was able to get the results I wanted!

    Thank you everyone for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic