Reply New Topic
2009/1/6 7:41:42
#1
Offline
Just can not stay away

newbbex adjustments

Hello all;)

First of all, Happy new year. May 2009 be the year that fullfill's your wishes.

Now for my question. I'm reviving my old gameclan's website, using ICMS (was Xoops) as a base. All of the modules I've used work greatly in ICMS, but I have a question about a block present in the newbbex module. Is it possible to make the "new posts block" show the users thread poster avatar? I currently have added an static image but want to show the user who posted the thread in the block.

Visible here: http://www.sdoo-clan.com

I know some will answer, "ask the developer!", but I know the developer will say "only Xoops is supported".

I really like the forum module as it simple and robust. Stability is and always will be my key motivation for using this module.

Can someone help me or guide me,.thanks alot in advanced;)

_________________
Core74 - Webdesign | Twitter | Flickr

2009/1/6 8:02:57
#2
Offline
Just can not stay away

Re: newbbex adjustments

As I'm already talking about posters avatars within blocks, is it possible to also show the users avatar in the "new comments post" block?

_________________
Core74 - Webdesign | Twitter | Flickr

2009/1/6 8:20:10
#3
Offline
Home away from home

Re: newbbex adjustments

yeah we all know he'll say only xoops is supported.. but, the same method that would be used for xoops 2.0.x branch is also the exact same method that would be used for icms.

but i bet the next answer there would be, use xoops 2.3.. lol

anyway, i'm pretty sure it wouldn't be difficult at all, the block is already pulling user data, so all would be needed is to add the avatar into the equation aswell.

can you post a link to the download of the version of newbbex that you have, and i'll take a look for you.

_________________
Live as if you were to die tomorrow, Learn as if you were to live forever

The beauty of a living thing is not the atoms that go into it, but the way those atoms are put together!

2009/1/6 23:11:19
#4
Offline
Just can not stay away

Re: newbbex adjustments


_________________
Core74 - Webdesign | Twitter | Flickr

2009/1/10 3:38:01
#5
Offline
Just can not stay away

Re: newbbex adjustments

Any luck Vaughan? Can I help in any way (this is a hidden bumpy;))?

_________________
Core74 - Webdesign | Twitter | Flickr

2009/1/10 6:28:04
#6
Offline
Home away from home

Re: newbbex adjustments

If you have the users' id (uid) it should be possible to get the avatar too from the database table 'users'.

_________________
McDonalds Store

2009/1/10 7:13:19
#7
Offline
Home away from home

Re: newbbex adjustments

Add the following 3 lines to the function b_newbbex_new_show in /blocks/newbbex_new.php (appr. line 130):
$av_sql = $db->query( "SELECT user_avatar FROM " . $db -> prefix( 'users' ) . " WHERE uid=" . $arr['uid'] );
$avatar = $db -> fetchArray( $av_sql );
$topic['avatar'] = '<img src="' . XOOPS_URL . '/uploads/' .$avatar['user_avatar'] . '" alt="" />';

// Hack nb page


Place the following in the template file to display the avatar:
<{$topic.avatar}>


I am not sure how-to when users have a Gravatar instead of an avatar.

_________________
McDonalds Store

2009/1/10 7:35:38
#8
Offline
Home away from home

Re: newbbex adjustments

I'll help you a bit more:

Open
modules/newbbex/blocks/newbbex_new.php

Find
// Hack nb page
(around line 140)

A little below that line you will find $tmpuser = XoopsUser::getUnameFromId($tmpdb['uid']);

We can add some more stuff here and then add it to the $topic variable.
Like :
$topic['useravatar'] = $xoopsUser->user_avatar();

Then in the $topic array the 'useravatar' (mine is blank.gif) is available and you can use it in the template.

Hope this helps.


2009/1/11 0:45:26
#9
Offline
Just can not stay away

Re: newbbex adjustments

Works like a sharm;) Thanks alot McDonald;) Will test your option Underdog;)

I'm a happy Duck http://www.sdoo-clan.com

_________________
Core74 - Webdesign | Twitter | Flickr

2009/1/11 0:53:54
#10
Offline
Home away from home

Re: newbbex adjustments

I think the solution of Underdog is the better one!

_________________
McDonalds Store

2009/1/11 1:08:40
#11
Offline
Just can not stay away

Re: newbbex adjustments

mm,.using the solution of Underdog does indeed display the avatar, but only the avatar of the current logged in user (me). And when I do logout, the whole page goes blank;) But I guess I have been pushed in the right direction now;)

_________________
Core74 - Webdesign | Twitter | Flickr

2009/1/11 3:21:45
#12
Offline
Home away from home

Re: newbbex adjustments

I think the blank page occurs because $xoopsUser isn't present.
Check my solution.

See
Like :
$topic['useravatar'] = $xoopsUser->user_avatar();

Replace with
Like :
if(is_object($xoopsUser))
{
$topic['useravatar'] = $xoopsUser->user_avatar();
}

I have to think about the other solution for showing avatars of users that are not logged in.
Maybe I made a mistake

The trick is to play a lot with the function icms_debug()
Especially in the area where the recent topics are fetched
(db->fetchArray i believe)
if you want to display an array within icms_debug, just use
icms_debug(print_r($array)); or icms_debug_vardump($array)

Maybe, just maybe you need to make an extra join (not joint :lmao:)
with the user table, but we can check that out later.


2009/1/11 7:42:14
#13
Offline
Home away from home

Re: newbbex adjustments

A problem with this code:
$topic['useravatar'] = $xoopsUser->user_avatar();

is that it doesn't use the uid of the poster, so there's no reference to the db. This is the reason it only shows the avatar when logged in.

Incama, the site looks great! Nice layout/theme.

_________________
McDonalds Store

2009/1/11 7:54:28
#14
Offline
Home away from home

Re: newbbex adjustments

why not use tmpuser?

$topic['useravatar'] = $tmpuser->getVar('user_avatar');


2009/1/19 9:56:51
#15
Offline
Just can not stay away

Re: newbbex adjustments

Thank all for the nice reaction,.it really helped me alot. As I'm finishing the website right now, is it possible to do the same trick with the latest comments block?

The hack for newbbex works great as it makes the website more personal (as personal an avatar can be ofcourse). Again,.thanks in advance;)

_________________
Core74 - Webdesign | Twitter | Flickr

2009/1/19 13:21:11
#16
Offline
Home away from home

Re: newbbex adjustments

not tested:

in modules/system/templates/blocks/system_block_comments.html

add the following line where you want it, you'll see when you open the template :)

<td align="center"><{$comment.avatar}></td>


in modules/system/blocks/system_blocks.php

around line 394:

find

$com['poster'] = '<a href="'.XOOPS_URL.'/userinfo.php?uid='.$comments[$i]->getVar('com_uid').'">'.$poster->getVar('uname').'</a>';


and either add $poster->getVar('user_avatar') to the $com['poster'] tag

or create a new $com['avatar'] = $poster->getVar('user_avatar');

if you just add the $poster to the URL above, then you shouldn't need to modify the template.. if you create the new $com['avatar'] = $poster->getVar('user_avatar');

then you'll need to also edit the template.

if that sounds confusing, let me know, and i'll reword it :)

_________________
Live as if you were to die tomorrow, Learn as if you were to live forever

The beauty of a living thing is not the atoms that go into it, but the way those atoms are put together!

2009/1/20 10:05:39
#17
Offline
Just can not stay away

Re: newbbex adjustments

Thanks Vaughan,.the second option did the trick;) Now I can take some rest;)

_________________
Core74 - Webdesign | Twitter | Flickr

2009/1/20 11:40:12
#18
Offline
Home away from home

Re: newbbex adjustments

you're welcome, glad it worked :)

_________________
Live as if you were to die tomorrow, Learn as if you were to live forever

The beauty of a living thing is not the atoms that go into it, but the way those atoms are put together!

Reply New Topic extras
 Previous Topic   Next Topic
You can view topic.
You can start a new topic.
You can reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You can post without approval.