Jump to content

Recommended Posts

Posted
if($user->isLoggedin() && !$input->get('profile') && !$input->get('logout')) {
echo '<h2>'.__('Mein Profil').'</h2>';
echo '<p><strong>'.$user->fields[130].': </strong>' . '<span>'.$user->givenname.'</span></p>';
echo '<p><strong>'.$user->fields[131].': </strong>' . '<span>'.$user->lastname.'</span></p>';
echo '<p><strong>'.$user->fields[92].': </strong>' . '<span>'.$user->email.'</span></p>';
echo '<p><strong>'.$user->fields[171].': </strong>' . '<span>'.$user->units_balance.'</span></p>';
}

I don't know why none of the values don't return anything (in the span tags). Also, the ->fields[] API is not very elegant either. 

Posted (edited)

It's hard to say what is your problem because $user->givenname should work if the template "user" has a field givenname with a value. So the problem is not this code, it's elsewhere.

17 hours ago, froot said:

Also, the ->fields[] API is not very elegant either. 

You shouldn't need this, I didn't even know it exists and I added 27 fields on the "user" template in my current project. 🙂

Where does $user variable comes from in your code?
Does the "user" template have all the properties?
What var_dump($user) returns?

Edited by da²
  • Like 1
Posted

$user is the native user https://processwire.com/api/ref/user/

Isn't that what this module interacts with?

Also, I'm actually using PageClass on the user class, i.e. 

class UserPage extends User {  }

not sure if that's the culprit. I can apparently access the fields on a UserPage object just fine however.

Posted

oh my, it was just a human error, I mixed up the logged-in accounts 🙈

Maybe I need to retire… or just need a vacation 😃

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...