1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.2 how to get resource author avatar in my template

Discussion in 'XenForo Questions and Support' started by arpitjain, Sep 3, 2013.

  1. arpitjain

    arpitjain Member

    i want to show each resource author name with its avatar how it is possible......thanks
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    You'll need to be a little more specific on where...
  3. arpitjain

    arpitjain Member

    i want to show each resource author avatar and his profile link with resource title
    in my add on template i am fetching resources from this code:

    <xen:foreach loop="$resources3" value="$resource">
    <li class="{$resource.resource_state}">
    <a style="" href="{xen:link resources, $resource}" class="resourceTitle">{$resource.title}</a>
    <xen:if is="{$pos} == 0">
    (<a data-avatarhtml="true" class="avatar Av203s" href="index.php?members/{$resource.user_id}/"><img width="20" height="20" align="absmiddle" alt="Oracle" src="data/avatars/s/0/203.jpg?1376110240"></a><xen:username user="$resource" rich="true" class="username" />)
    <xen:else />
    (<xen:username user="$resource" rich="true" class="username" />)


    i want to show link and image related to author ...and want to redirect to his profile .....is there any function through which i can redirect to author profile by using his id for any forum
    and what are s/0 and s/1 in image path
  4. arpitjain

    arpitjain Member

    is there any function to get avatar url(path) and it's link from the id of author ....
    Last edited: Sep 4, 2013
  5. Dan

    Dan Well-Known Member

    Yes, you can use the <xen:avatar function.

    <xen:avatar user="$resource" />
  6. arpitjain

    arpitjain Member

    can i change the size of avatar within this function.. i want to show 20 by 20 avatar
  7. arpitjain

    arpitjain Member

    i have put this code but all avatar are the default avatar ....not there uploaded avatar s
    <xen:foreach loop="$resources1" value="$resource">
    <li class="{$resource.resource_state}" style="vertical-align:top;">
    <div style="width:auto">

    <xen:avatar user="$resource" img="true" />

    <a href="{xen:link resources, $resource}" class="resourceTitle">{$resource.title}</a>
    (<xen:username user="$resource" rich="true" class="username" />)
    <div style="clear:both;"></div>
    Last edited: Sep 4, 2013
  8. Jeremy

    Jeremy XenForo Moderator Staff Member

  9. xf_phantom

    xf_phantom Well-Known Member

    how do you fetch the resources?

    It seems that you don#t fetch all necessary data
  10. arpitjain

    arpitjain Member

    i am fetching through query and passing as an array with parent...
    $resources1 = $db->fetchAll("SELECT * FROM `xf_resource` where `resource_state`='visible' order by rating_weighted DESC limit 0,$latestResourcePerPage");

Share This Page