Pedigree Music is a news / blog website (depending on how you look at it) with multiple writers, and newly integrated community features. The site has been up for a while now but I have just completed a major redesign.
The modules used are all available through drupal.org but a lot of work uses the template.php file, such as the 'members', 'blogs', and 'comments' blocks.
To get pages such as custom user profiles, I just used the phptemplate_callback function along with custom *.tpl.php pages.
The forum is just the drupal forum with the flatforum module. I then styled it similar to invision (I think) to see what can be done.
All image handling - including avatars - is done with the imagecache module and cck to add the post image field. The image module was used in the past along with image assist but was not quite what we needed so was removed. Unfortunately, some remains of image assist still exist in some posts so I will have to sort that out.
I don’t want to bore you with details too much but if you want to know how anything specific was done then I’ll try to explain.
Comments
Hi Great job, i like the
Hi
Great job, i like the way you make your website, your visitors will find easy to stay to your website, the menus are on all the page, also the member listing is cool, blog listing, tabs etc, how do u make the members, blogs blocks, nice theme, and real sexy profile page :)
The blocks are quite simple
The blocks are quite simple actually. I'll use the recent members block as an example.
I installed Javascript Tools to get the tabs.
I installed Imagecache to handle the avatar resizing.
I added functions to my template.php that query the databases to get the recent and online members:
<?php
function sidebar_newest_members() {
$gnm = db_query("SELECT uid,name,picture FROM {users} WHERE uid > 0 AND access > 0 ORDER BY uid DESC LIMIT 0,9");
while ($snm = db_fetch_object($gnm)) {
$output = '<div class="picture">';
if ($snm->picture) {
$output .= l(theme("imagecache", "avatar", $snm->picture, $snm->name."'s user picture", $snm->name."'s user picture"), "user/".$snm->uid, array('title' => $snm->name), NULL, NULL, FALSE, TRUE);
}
else {
$output .= l(theme("imagecache", "no-avatar", "files/pictures/no-avatar.gif", $snm->name."'s user picture", $snm->name."'s user picture"), "user/".$snm->uid, array('title' => $snm->name), NULL, NULL, FALSE, TRUE);
}
$output .= '</div>';
print $output;
}
}
function sidebar_online_members() {
// Count users with activity in the past defined period.
$interval = time() - variable_get('user_block_seconds_online', 900);
// Perform database queries to gather online user lists. We use s.timestamp
// rather than u.access because it is much faster.
$anonymous_count = sess_count($interval);
$authenticated_users = db_query('SELECT u.uid, u.name, u.picture FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE s.timestamp >= %d AND s.uid > 0 ORDER BY s.timestamp DESC LIMIT 0,9', $interval);
$authenticated_count = db_num_rows($authenticated_users);
// Display a list of currently online users.
// $som - online member
if ($authenticated_count) {
$items = array();
while ($som = db_fetch_object($authenticated_users)) {
$output = '<div class="picture">';
if ($som->picture) {
$output .= l(theme("imagecache", "avatar", $som->picture, $som->name."'s user picture", $som->name."'s user picture"), "user/".$som->uid, array('title' => $som->name), NULL, NULL, FALSE, TRUE);
}
else {
$output .= l(theme("imagecache", "no-avatar", "files/pictures/no-avatar.gif", $som->name."'s user picture", $som->name."'s user picture"), "user/".$som->uid, array('title' => $som->name), NULL, NULL, FALSE, TRUE);
}
$output .= '</div>';
print $output;
}
}
}
?>
I created a custom block which calls and displays the functions:
<div id="sidebar-member-tabs" class="sidebar-tabs"><ul class="tab-switch-cont">
<li class="tab-switch"><a href="#newest-members">Newest</a></li>
<li class="tab-switch"><a href="#online-members">Online</a></li>
</ul>
<div id="newest-members">
<h3>Newest Members</h3>
<?php sidebar_newest_members() ?>
<div class="clear"></div>
</div>
<div id="online-members">
<h3>Online Members</h3>
<?php sidebar_online_members() ?>
<div class="clear"></div>
</div>
</div>
<div class="sidebar-member-stats">
<?php sidebar_member_stats() ?>
</div>
<div class="clear"></div>
<div class="more-link"><?php print l('Member List', 'profile') ?></div>
This is my exact code but if you end up using it you will need to:
If you need me to be more specific then just ask.
--------------------------------------------------
Martin - Pedigree Music - Drupal Powered Music Blog
-----------------------------------------------------------------------------
Martin - On Fire Digital - Web Design & Development
path problem
This is a great solution, and I almost got it to work on a site I'm building. However, since I'm such a php novice, I'm not exactly sure how to configure the code so that I get the actual path I need.
When I insert the original text, it creates a user avatar path of:
domain.com/files/imagecache/avatar/files/pictures/picture-2.jpg
However, I really need it to omit the "imagecache/avatar/files" section of the path, so that it searches at:
domain.com/files/pictures/picture-2.jpg
(which is the directory of where my user avatar images are)
I messed a bit with the template.php component, removing "imagecache" and "avatar" and it just made a nice mess.
Any help you can provide is much appreciated.
By the way, you have a great site.
I've modified the online
I've modified the online users section to work with content profile with the avatar being saved in a cck file field. I am using drupal 6.
<?php
function sidebar_online_members() {
// Count users with activity in the past defined period.
$interval = time() - variable_get('user_block_seconds_online', 900);
// Perform database queries to gather online user lists. We use s.timestamp
// rather than u.access because it is much faster.
$anonymous_count = sess_count($interval);
$authenticated_users = db_query('SELECT u.uid, u.name, u.picture FROM {users} u INNER JOIN {sessions} s ON
u.uid = s.uid WHERE s.timestamp >= %d AND s.uid > 0 ORDER BY s.timestamp DESC LIMIT 0,9', $interval);
$authenticated_count = db_affected_rows($authenticated_users);
// Display a list of currently online users.
// $som - online member
if ($authenticated_count) {
$items = array();
while ($som = db_fetch_object($authenticated_users)) {
$content_profile = content_profile_load('profile', $som->uid);
$pict = $content_profile->field_avatar[0]['filepath'];
$output = '<div class="picture" style="float:left; padding:10px;"><div>';
if ($content_profile->field_avatar) {
$output .= l(theme("imagecache", "avatar", $pict, $som->name."s user picture", $som->name."'s user picture"), "user/".$som->uid, array('title' => $som->name, html=>TRUE));
}
else {
$output .= l(theme("imagecache", "avatar", "files/pictures/no-avatar.gif", $som->name."'s user picture", $som->name."'s user picture"), "user/".$som->uid, array('title' => $snm->name, html=>TRUE));
}
$output .= '</div><div style="clear:both;" align="center">Online Now!</div></div>';
print $output;
}
}
}
?>
<div id="sidebar-member-tabs" class="sidebar-tabs">
<div id="online-members">
<h3>Your mate could be online right now!</h3>
<?php sidebar_online_members() ?>
<div class="clear" style="clear:both;"></div>
</div>
</div>
<div class="clear"></div>
I really like how you did
I really like how you did the user blogs block, How would I go about putting users pictures into the block like that?
nice
nice job .....
-- Sree --
IRC Nick: sreeveturi
Hi mjmalloy, I assume that
Hi mjmalloy,
I assume that you're running Drupal 5. But, how exactly did you apply the flatforum style to the existing core Drupal forum module? Care to explain how you did it?
I'm planning to do something similar but do not want to use the Advanced Forum, which needs a lot of modules plugged together.
Cheers,
yeeloon
- yeeloon
kini.my
Huh?
Advanced Forum depends on the same modules flatforum does: forum and comment. It's actually based on flatforum, though there's not much of the original code left. Flatforum hasn't been maintained in some time so I don't reccomend using it. If you really want to, though, the HEAD version works with D5. It won't be ported to D6, though, so it's a dead end.
Michelle
--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.
-----
Shell Multimedia - My sporadically updated mostly Drupal blog.