See it in action at the bottom of this page: http://www.oaklandorthopedic.com/healthy-lifestyle-column/nothing-tastes-good-it-feels-be-thin/
Create Blog Post Author’s Profile Page(s)
Before you begin, create a profile page for every user who will be contributing to the blog. This page can be anywhere on the website. Then follow these instructions:
Creating User Attributes for Blog Post Author’s Full Name
- Create a custom user attribute by going to (Dashboard > Members > Attributes) and adding a text attribute.
- Handle: full_name and Name: Full Name (and check all boxes under Public Display, Edit Mode, and Registration)
- Select these boxes: (Editable in Profile and Editable and Required in Profile)
- Click “Save”
Creating User Attributes for Blog Post Author’s Custom Profile Page
- Create a custom user attribute by going to (Dashboard > Members > Attributes) and adding a text attribute.
- Handle: link_to_profile
Name: Link to Profile (and check all boxes under Public Display, Edit Mode, and Registration) - Select these boxes: (Editable in Profile and Editable and Required in Profile)
- Click “Save”
Creating New User for Anyone Who Will be Writing Blog Posts
- Dashboard > Members > Search Users > Add User
- Enter a Username, Password, and Email,
- Make sure to upload a small image for the user’s avatar, as well as populating the new fields you just created called "Full Name" and "Link to Profile" (this should be the full absolute path to a profile page for this particular user that you’ve already created in Step One.)
- Check the box that says “Administrators” and click “Add”.
Now, go to your theme and open blog_entry.php
Right below the main content area, paste this code:
<div style="margin-top:15px;">
<a href="<?php
$c = Page::getCurrentPage();
$uID = $c->getCollectionUserID();
$ui = UserInfo::getByID($uID);
print $ui->getAttribute('link_to_profile');
?>">
<?php
$username = $c->getVersionObject()->getVersionAuthorUserName();
$ui = UserInfo::getByUserName($username);
if ($ui->hasAvatar() == true) {
$av = '<img class="avatar" src="'.BASE_URL.DIR_REL.'/files/avatars/'.$ui->getUserID().'.jpg'.'" alt="'.$userName.'" />';
echo $av;
} else {
echo '';
}
?>
</a>
Written by: <br/><em style="color:gray">
<a href="<?php
$c = Page::getCurrentPage();
$uID = $c->getCollectionUserID();
$ui = UserInfo::getByID($uID);
print $ui->getAttribute('link_to_profile');
?>">
<?php
$c = Page::getCurrentPage();
$uID = $c->getCollectionUserID();
$ui = UserInfo::getByID($uID);
print $ui->getAttribute('full_name');
?>
</a>
</em>
</div>
Open main.css , paste this code:
img.avatar {border:1px solid #b6b6b6; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; padding:2px; float:left; margin-right:7px}
Loading Conversation