Hey, I'm trying to display user information like a User's website URL from profile to a certain area of the content area.

Here's what I've done so far:

function MyTheme_preprocess_author_pane(&$variables) {
  $node = $node = menu_get_object();

    $allowed_types = variable_get('author_pane_block_display_types', array());
    if (empty($allowed_types[$node->type])) {
      // Not a type we want to show on.
      return;
    }

    $uid = $node->uid;

  // Load up the user object
  $account = user_load($uid);
  profile_load_profile(&$account);
  $variables['user_website'] = $account->profile_website;
  $variables['account'] = $account;
}

I put the above code in my template.php

Then, I added the variable $user_website in the author-pane.tpl.php.

Can you please help me? Your module is extremely complicated in terms of displaying profile information, I dunno what to do anymore.

Comments

executex’s picture

For some reason profile_load_profile doesn't work, even though $account seems to be the right user object with the user_id...

Why does $account not have my profile fields???

michelle’s picture

Status: Active » Postponed (maintainer needs more info)

Displaying profile information with AP is as easy as printing a variable. Hardly "extremely complicated". I can't tell from what you have there what category your field is in so you'll have to fill that in yourself. I can't remember if categories are required since I don't use the profile module. If you don't have a category, you can probably just delete that whole segment. Not 100% sure on that.

<?php print $profile['CATEGORY']['profile_website']['#value']; ?>

Michelle

executex’s picture

Of course it's extremely complicated...

If it was easy, a simple $profile variable would automatically be provided to all templates, but it's not. Instead I have to load my own user, load my own profile everything...

If I do exactly what you said,...

      var_dump($profile);
      

Inside author-pane.tpl.php, what happens? NULL.

Anyone who uses drupal and doesn't know how to code with drupal, would have no idea how to use this module except the already provided "Block". The simple fact that I have to do this inside node.tpl.php shows how complicated this module is

$us = user_load($node->uid);
    print theme('author_pane', $us, 'author_pane_block');

In fact, the "author_pane_block" still goes to author-pane.tpl.php, not author-pane-block.tpl.php, and I have to replace it inside the module folder, putting it in my theme folder has 0 effect. In other words, when there is an update to this module, I have to recopy my versions of the file.

I can't even find the damn theme_author_pane function, it's hidden somewhere...

The readme says the third parameter is $caller... but in the documentation online for authorpane, it claims that the third parameter is "image_path". So which is it? Why is the documentation so vague?

michelle’s picture

Status: Postponed (maintainer needs more info) » Active

Ok, this whole post is a mess and you are mixing two different versions together so it's hard for me to even figure out what your problem is. And, frankly, your attitude makes me not want to try. I'll leave this open in case someone else wants to help.

Michelle

executex’s picture

The whole post is explained in a way that anyone who has dealt with this module would understand. With extra details and code for convenience, ease, and speedy feedback; just to make your life easier.

I really don't know how to explain it any better than $profile is NULL... I mean is that so hard to understand for you?

It's very easy to FALSELY accuse someone for "attitude" in order to, avoid any real work, not add any documentation, and publish a module that only has very basic functions while claiming to have more complex functions. Don't worry , you're not alone, there are tons of people who release modules and then never update them or help people fix them (they take drupal's links for granted).

Since, you haven't even attempted to help me, didn't add any documentation (The documentation you have is so vague and doesn't even work), and released such a crappy module, I have no guilt in-- NOW-- showing attitude to someone as disrespectful as you. I asked nicely, but apparently, you just don't care...

Your attitude is the kind that is keeping modules in the drupal community from being developed... It is your job to help me, but I understand maybe it is way beyond your skills and maybe you work hard but people have strange problems, but it is your job (you help people in exchange for drupal's powerful links).

"mixing two different versions together" WTF? I use only one version btw.

michelle’s picture

Your first mistake is thinking this is my job. It's not. Drupal is a hobby and I maintain these modules on a volunteer basis. No one is paying me for this and I am in no way required to help you. I do my best to help people who come to me for support but I have no interest in helping someone who comes in and starts bashing me.

I have no idea why $profile is null for you. I can't even guess why. Assuming you had enough of a clue to turn on the profile module and have profile fields filled in for the user in question, it should be working.

The documentation seems to be working just fine for the other 7 thousand people using the module. I'm not going to claim it's perfect; documentation is never really done. But it's pretty well documented and works as advertised for most people.

Michelle

michelle’s picture

Oh, and I said you are mixing two versions because you refer to $caller, which is only in 2.x.

Michelle

ndevelder’s picture

I think the number one rule when asking for help is to respect the incredible amount of coding work that module maintainers have made available to you FOR FREE. I happened across this thread because I'm having trouble with profile_load_profile() myself...but now I have a suggestion for you and hopefully someone in the future will find it of use... Is it so hard to understand the concept (and beauty) of a volunteer driven community? If you need immediate answers...pay for them or pay for a cms in which you get technical support.

Have you looked at the syntax of your profile_load_profile() statement in your original post? I could be wrong about this, but by placing an ampersand in front of the variable name, you make it a reference variable with no focus. Profile_load_profile takes a user object (the reference variable, and hence ampersand, only appear in the function definition). By removing the ampersand, you should have a user object in the variable named $account and profile_load_profile() should append the profile array to your $account variable. I use the same code in my user-profile.tpl.php and it works fine... (however I'm now trying to use it within a contemplate altered cck output and the profile_load_profile() function is not working...so maybe take what i'm saying with a grain of salt)

You might also want to find a place to stick a print_r($account) once you do get the profile loaded...(you'd have to reload the user object and profile, using your above code, on a user page for example) sometimes the profile fields you need are array elements... i.e. $account->profile_website['address'] (just an example - not real) and can be tricky to guess before viewing the entire array....

And I don't know what you're on...but what could you possibly mean by working in exchange for "powerful links" ?!? You sound like you might need to put down those web marketing books and start getting a little more sleep...

michelle’s picture

Status: Active » Closed (won't fix)

@ndevelder: Thanks. Since none of that stuff he had in his original post is even needed to print the profile information in AP, I didn't look closely at the code. Now that I do I see he's saying that profile_load_profile isn't working, which would explain why the variable is NULL for him. That's the function AP uses. If that core function is not working on his site, then there is no way for AP to get the profile information. So it sounds like this problem has nothing to do with AP at all.

I've left this open for over a week and now it looks like the problem is elsewhere. So there's nothing more that can be done in this queue.

Michelle