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

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








<{foreach item=page from=$pages}>
" onclick="window.location='<{$xoops_url}>/modules/userpage/index.php?page_id=<{$page.up_pageid}>'">






<{/foreach}>
------------------------------------


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

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


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:

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:



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



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:

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

<{$smarty.const._USERPAGE_AVATAR}>
<{$smarty.const._USERPAGE_USER}>
<{$smarty.const._USERPAGE_TITLE}>
<{$smarty.const._USERPAGE_DATE}>
<{$smarty.const._USERPAGE_HITS}>
<{$page.user_avatar}>
<{$page.up_created}>
<{$page.up_hits}>





<{$up_title}>



<{if $up_text}>

<{$up_text}>

<{else}>

<{$smarty.const._USERPAGE_EMPTY_PAGE}>

<{/if}>





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

thanks

Login

Who's Online

1203 user(s) are online (84 user(s) are browsing Support Forums)


Members: 0


Guests: 1203


more...

Donat-O-Meter

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

Latest GitHub Commits