Download & Extend

How to use with custom profile.tpl?

Project:Favorite Nodes
Version:5.x-1.x-dev
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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?

Comments

#1

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

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

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; ?>