How do I get User Attributes?
Permalink
Hi
I'm new to php and I'm creating a blog site with Concrete5
I've largely used the sample data to get up and running, but I'm looking to change the user name on my blog postings. I want to log in as "admin", but I want blog posts to show my Pseudonymn.
I've created an additional attribute in the user database called "display_name", but I don't know how to call it.
This is the section in "blog_entry.php", that needs editing.
I know I could just append the name to, but I want to be able to get my head around coding in php.
Any help would be very much appreciated.
I'm new to php and I'm creating a blog site with Concrete5
I've largely used the sample data to get up and running, but I'm looking to change the user name on my blog postings. I want to log in as "admin", but I want blog posts to show my Pseudonymn.
I've created an additional attribute in the user database called "display_name", but I don't know how to call it.
This is the section in "blog_entry.php", that needs editing.
I know I could just append the name to
t('Posted by')
Any help would be very much appreciated.
Brilliant. Thanks jordan!
I had to change
to:
but it works perfectly.
Thanks again!
I had to change
$uid = Page::getByID($cobj->getCollectionID(), 1)->getVersionObject()->getVersionAuthorUserID();
to:
$uid = Page::getByID($c->getCollectionID(), 1)->getVersionObject()->getVersionAuthorUserID();
but it works perfectly.
Thanks again!
Ahh yes, I mistakenly thought you were talking about the blog_listing page list template, not the blog_entry page type template. Updating my answer to reflect this.
Hi jordan
Yes, I realised that when I went in to change the blog_listing page list after I'd done the blog_entry page.
It was really helpful, thanks again.
Yes, I realised that when I went in to change the blog_listing page list after I'd done the blog_entry page.
It was really helpful, thanks again.
Now you can echo $display_name wherever you need in your template. Note that this only retrieves the author associated with the most recent edit to that blog post, not the original author. If you want to get the original author, replace the first line of that code with this: