Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I would like to add 'this user has x amount of relationships' to the content profile template.
Something similar exists for flags as follows:
<?$flag = flag_get_flag('recommend') or die('No "recommend" flag!');
$count = $flag->get_count($uid);
if ($count == 0) {
print t("");
} else {
print t('This Member has <a href="@view-url">@in-words</a>', array(
'@view-url' => url("user/$uid/recommendations"),
'@in-words' => format_plural($count, '1 Recommendation', '@count Recommendations'),
));
}?>
Please, how would I change that for relationships?
Look forward to any reply, and thank you.
Comments
Comment #1
63reasons-AS CreditAttribution: 63reasons-AS commentedComment #2
63reasons-AS CreditAttribution: 63reasons-AS commentedComment #3
Liliplanet CreditAttribution: Liliplanet commentedIt's been a while .. please would be wonderful if I could either add in a block on or the custom profile tpl
user has X amount of relationships, and perhaps by relationship type?
x number of fans
x number of colleagues
Most appreciate any reply, and thank you :)
Comment #4
Liliplanet CreditAttribution: Liliplanet commented* bump * sorry .. but this is important, any help most appreciated :)
Comment #5
alexx90 CreditAttribution: alexx90 commentedin drupal forums you will never get answer just forget about that
i asked many times for help before you but no one alive her
Comment #6
mrf CreditAttribution: mrf commentedUser relationships doesn't have a function to return a relationships count, but I needed this for UR Limits.
If you install the module you can then use:
Substitute the ID of your relationship for $rtid and $uid is the user's id.
Or just take that function and adapt it for your own needs.
Comment #7
RKS CreditAttribution: RKS commentedI wonder what you would include as $uid if you wanted it global? So if "Friend" is 1 you could substitute that easily but for all users and not just one how would you substitute?
Comment #8
mrf CreditAttribution: mrf commentedReturning pending and total counts for a particular user is a common request and could be useful within the modules own UI.
Comment #9
Blue CreditAttribution: Blue commentedThis should better be done with views. Subscribe