Jump to content


Photo

creators username


  • Please log in to reply
3 replies to this topic

#1 martind

martind

    Jr. Member

  • Members
  • PipPip
  • 25 posts
  • 0

  • LocationAustria

Posted 08 October 2011 - 05:00 PM

hi.
I`m new on pw and the forum here. First of all, thank you for this great piece of software. I did a bunch of projects on expressionengine and other cms over the last 10 years, but pw lets taste a gentle breeze of revolution.

my question: i tried to resolve the username of a page creator from $pages, but had no luck. Any suggestions?
    $texte = $pages->find("template=submitlist");
    foreach($texte as $s)
    	echo "<li><p><a href='{$s->url}'>{$s->title}</a> [{$s->createdUser}".date('d.m.Y H:i:s', $s->created)."]</li>";


thx, martin

#2 apeisa

apeisa

    Hero Member

  • Moderators
  • 2,531 posts
  • 861

  • LocationVihti, Finland

Posted 08 October 2011 - 05:28 PM

Hi Martin and welcome to the forums.

$s->createdUser right thing here, but it returns user object (which is actually just a regular page like others), so $s->createdUser->name should return user's login name.

Gotta mention here, that user template (=user profile) is also just a normal template, so you can add more fields there too (like firstname, lastname, phone number, image, address etc..) and use those values just as easily: $s->createdUser->firstname

#3 martind

martind

    Jr. Member

  • Members
  • PipPip
  • 25 posts
  • 0

  • LocationAustria

Posted 09 October 2011 - 06:07 AM

works perfect, thank you.

#4 onjegolders

onjegolders

    Hero Member

  • Members
  • PipPipPipPipPip
  • 806 posts
  • 213

  • LocationMidlands, UK

Posted 16 April 2012 - 12:10 PM

Thanks Apeisa, this helped me too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users