How to use with custom profile.tpl?

dzynz - October 11, 2007 - 19:12
Project:Favorite Nodes
Version:5.x-1.x-dev
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I'm using a very involved custom profile template and would like to include the user-favorites list in it. How might I accomplish this?

#1

dzynz - October 11, 2007 - 19:31

Sorry - I found this

<div id="favorites">
<?php
        $info
= favorite_nodes_user($op = "view", $edit, $user);
        foreach(
$info as $value){
            foreach(
$value as $stuff){
                foreach(
$stuff as $moreStuff){
                    if(
$moreStuff){
                        print(
$moreStuff);
                    }              
                }
            }
        }  
   
?>

</div>

But it really doesn't work the way it does on an un-templated profile. How can I get that functionality?

#2

asund - January 28, 2008 - 16:49

Hi!
I had the same problem, but solved it by making a view with an argument for Added to favorite by ID and then just embedded the view in the profile using this code:

<?php
$view_name
= 'profilefaves'; //name of view
$view_args = array($user->uid);
$view = views_get_view($view_name);
print
views_build_view('embed', $view, $view_args, $view->use_pager, $view->nodes_per_page);
?>

#3

neubreed - January 6, 2009 - 01:12

Here's another way to to do a teaser list in user_profile.tpl.php without needing to create a view

<?php $list = favorite_nodes_get($profile->uid, 'audio'); ?>
<?php if($list): ?>
    <?php print theme('favorite_nodes_view_teasers', $list, $profile->uid, 'Music'); ?>
<?php endif; ?>

 
 

Drupal is a registered trademark of Dries Buytaert.