1
kakafuate
How can I show the Avatar in another Module??
  • 2008/10/23 19:40

  • kakafuate

  • Just popping in

  • Posts: 12

  • Since: 2006/3/1 1


hallo everybody

i need the php code to show the user avatar in the Modul "userpage" ... a new row (the first) by the template userpage_list.html is ready ... i write something like this but not work

-----------------------------------
<table border="0" width="95%">
<tr>
<th align="center"><div align="left"><{$smarty.const._USERPAGE_AVATAR}></div></th>
<th align="center"><div align="left"><{$smarty.const._USERPAGE_USER}></div></th>
<th align="center"><div align="left"><{$smarty.const._USERPAGE_TITLE}></div></th>
<th align="center"><div align="left"><{$smarty.const._USERPAGE_DATE}></div></th>
<th align="center"><div align="left"><{$smarty.const._USERPAGE_HITS}></div></th>
</tr>
<{foreach item=page from=$pages}>
<tr class="<{cycle values="even,odd"}>" onclick="window.location='<{$xoops_url}>/modules/userpage/index.php?page_id=<{$page.up_pageid}>'">
<td align="center"><div align="left"><{$page.user_avatar}></div></td>
<td><div align="left"><a href="<{$xoops_url}>/userinfo.php?uid=<{$page.up_uid}>"><{$page.user_name}></div></td>
<td><div align="left"><a href="<{$xoops_url}>/modules/userpage/index.php?page_id=<{$page.up_pageid}>"><{$page.up_title}></a></div></td>
<td align="center"><div align="left"><{$page.up_created}></div></td>
<td align="center"><div align="left"><{$page.up_hits}></div></td>
</tr>
<{/foreach}>
</table
------------------------------------


thanks all

ps
in the index.php is something about this:

$xoopsTpl->assign('up_pageid',$page->getVar('up_pageid'));
$xoopsTpl->assign('up_title',$page->getVar('up_title'));
$xoopsTpl->assign('up_text',$page->getVar('up_text'));
$xoopsTpl->assign('up_created',$page->getVar('up_created'));
$xoopsTpl->assign('up_uid', $page->getVar('up_uid'));

$page_user = null;
$page_user = new XoopsUser($page->getVar('up_uid'));
if(is_object($page_user)) {
$xoopsTpl->assign('user_avatar', XOOPS_UPLOAD_URL.'/'.$page_user->getVar('user_avatar'));
$xoopsTpl->assign('user_name', $page_user->getVar('name'));
$xoopsTpl->assign('user_uname', $page_user->getVar('uname'));
$xoopsTpl->assign('user_email', $page_user->getVar('email'));
$xoopsTpl->assign('user_url', $page_user->getVar('url'));
$xoopsTpl->assign('user_from', $page_user->getVar('user_from'));
$xoopsTpl->assign('user_sig', $page_user->getVar('user_sig'));
}



2
trabis
Re: How can I show the Avatar in another Module??
  • 2008/10/23 20:19

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


You can change userpage_list.php and replace the foreach loop by this one:
foreach($pages as $page) {
    
$page->setVar('dohtml',$allowhtml);
    
$page_user = new XoopsUser($page->getVar('up_uid'));
    
$xoopsTpl->append('pages',array(
        
'up_pageid' => $page->getVar('up_pageid'),
        
'up_uid' => $page->getVar('up_uid'),
        
'user_name' => $page->uname(),
        
'user_avatar' => XOOPS_UPLOAD_URL.'/'.$page_user->getVar('user_avatar'),
        
'up_title' => $page->getVar('up_title'),
        
'up_text' => $page->getVar('up_text'),
        
'up_created' => formatTimestamp($page->getVar('up_created'),userpage_getmoduleoption('dateformat')),
        
'up_hits' => $page->getVar('up_hits')
    ));
}


Not tested.
Please, include the image html tags. The above is just for the picture source.




3
kakafuate
Re: How can I show the Avatar in another Module??
  • 2008/10/23 21:56

  • kakafuate

  • Just popping in

  • Posts: 12

  • Since: 2006/3/1 1


hola trabis gracias !!! it's work

thanks

4
trabis
Re: How can I show the Avatar in another Module??
  • 2008/10/23 22:15

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Before you edit your post there were image tags inside. Jut put them back again. Something like <img src='<{user_avatar}>' alt=''/>

Right?

5
trabis
Re: How can I show the Avatar in another Module??
  • 2008/10/23 22:16

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Ahah, come on, stop editing your post. If someone comes over here they will think I´m crazy!

Sure I am.

6
zyspec
Re: How can I show the Avatar in another Module??
  • 2008/10/23 22:19

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


<deleted><deleted> Original post changed...

7
kakafuate
Re: How can I show the Avatar in another Module??
  • 2008/10/23 22:42

  • kakafuate

  • Just popping in

  • Posts: 12

  • Since: 2006/3/1 1


excuse me for change/edit the post,

first time i didn't find the file userpage_list.php, one minute later later i find it and make the change you said

at the second time i try with the html for image like this:

<img src='<{user_avatar}>' alt=''/> but don't work ... this only work for the user page (one page) and not for the page list

for the page list work this:

<img src="<{$page.user_avatar}>" alt="" width="65" height="80" />

thank you very much and excuse me again

8
kakafuate
Re: How can I show the Avatar in another Module??
  • 2008/10/23 22:44

  • kakafuate

  • Just popping in

  • Posts: 12

  • Since: 2006/3/1 1


you can see the changes hier:

http://www.lalenin.com/escuelalenin/modules/userpage/userpage_list.php?op=list&start=0


9
kakafuate
Re: How can I show the Avatar in another Module??
  • 2008/10/24 7:57

  • kakafuate

  • Just popping in

  • Posts: 12

  • Since: 2006/3/1 1


good morning travis and zyspec, i promese that i don't edit the post again

the avatar ist showing now only by a user that have a page (text in the page), and i missing this for a user without page (EMPTY PAGE) ...

also when the user goes at the first time to edit his page, one image is there but you can't see this

in both cases is the same template: userpage_index.html:

-----------------------------------------------------------

<table>
<tr>
<td><img src="<{$user_avatar}>" alt="" width="125" height="146" /></td>
<td><h2><{$up_title}></h2>

<{if $up_text}>

<{$up_text}>

<{else}>

<div style='text-align:left;'><{$smarty.const._USERPAGE_EMPTY_PAGE}></div>
<{/if}>
<br /><br />
</td>
</tr>
</table>

-----------------------------------------------------------

thanks

Login

Who's Online

292 user(s) are online (200 user(s) are browsing Support Forums)


Members: 0


Guests: 292


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits