xoops forums

Forum Index


Board index » All Posts (trabis)




trabis

Core Developer
Posted on: 2006/9/15 8:38
trabis
trabis (Show more)
Core Developer
Posts: 2268
Since: 2006/9/1 1
#1891

Re: Adding avatars to news items??

Hymseen
I´m a newbie in Xoops, php and sql so I did it the same way as you... researching. I don´t know if this is the best or optimized or convencional way to do do it but here it goes:

I "messed" in 3 files:

article.php (to get the avatar on each article)
class/class.newsstory.php (to get the avatar in front page)
templates/news_item.html (to display the avatar)

In article.php around line 270 and below "$xoopsTpl->assign('mail_link',
'mailto:?subject='.sprintf(_NW_INTARTICLE,$xoopsConfig['sitename']).'&body='.sprintf(_NW_INTARTFOUND, $xoopsConfig['sitename']).': '.XOOPS_URL.'/modules/news/article.php?storyid='.$article->storyid());"
I pasted this code:
global $xoopsDB;
$result $article->uid();
$result2 $xoopsDB->query("SELECT user_avatar FROM ".$xoopsDB->prefix("users")." where uid='$result'");
$result3 $xoopsDB->fetchArray($result2);    
$story['avatar_url'] =  XOOPS_URL.'/uploads/'.$result3['user_avatar'];


In class/class.newsstory.php around line 600 (in the function "function prepare2show($filescount)") below "$story['posttime'] = formatTimestamp($story['posttimestamp'],getmoduleoption('dateformat'));" i´ve pasted this code (similar but not equal):
global $xoopsDB;
$result $this->uid();
$result2 $xoopsDB->query("SELECT user_avatar FROM ".$xoopsDB->prefix("users")." where uid='$result'");
$result3 $xoopsDB->fetchArray($result2);    
$story['avatar_url'] =  XOOPS_URL.'/uploads/'.$result3['user_avatar'];


In news_item.html you have to paste this in where you want the avatar to be displayed:
<img src="<{$story.avatar_url}>">

I used this way

<
div class="itemBody"><img src="<{$story.avatar_url}>" 
align="right"/><class="itemText"><{$story.text}></p>

so it replace the topic image!


One thing to have in mind: Some themes have their own news_item.html so if your theme as it you have do do your changes there!
Clear your templates and refresh the news module.

Tip:You can also get a default avatar for your users by modifing uploads/blank.gif

Well, I think that´s all.
Let me know if you where sucessful!
Thanks!


trabis

Core Developer
Posted on: 2006/9/8 21:44
trabis
trabis (Show more)
Core Developer
Posts: 2268
Since: 2006/9/1 1
#1892

Re: Adding users vote + user visit counter in your member's profils

"
ALTER TABLE `xoops_users`
ADD `hits` int(11) NOT NULL default '0',
ADD `rating` double(6,4) NOT NULL default '0.0000',
ADD `votes` int(5) unsigned NOT NULL default '0',
"

OK... I took off the last comma and it went fine!

But now I get this error when trying to vote:


"Notice: Undefined index: submit in file /user_rate.php line 32"

I clear my templates and updated the system module and I can't see no extra tables on the profile. The button to vote has nothing wrote inside.

It seems there is some "define" missing.
For example:

_US_RATETHISUSER


Have you forgot something???


trabis

Core Developer
Posted on: 2006/9/8 11:57
trabis
trabis (Show more)
Core Developer
Posts: 2268
Since: 2006/9/1 1
#1893

Re: Adding users vote + user visit counter in your member's profils

I´m using MySQL client version: 4.1.21

I had this error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE `trb_users_votedata` (
`ratingid` int(11) unsigned NOT NULL auto' at line 7

Can you help me on this?


trabis

Core Developer
Posted on: 2006/9/7 17:15
trabis
trabis (Show more)
Core Developer
Posts: 2268
Since: 2006/9/1 1
#1894

Re: Adding avatars to news items??

Is this what you need??
My site

Have you find a tutorial about these???
If you still need these I can write one!

Sorry my bad english


trabis

Core Developer
Posted on: 2006/9/1 18:18
trabis
trabis (Show more)
Core Developer
Posts: 2268
Since: 2006/9/1 1
#1895

Re: Plenty of modules not working with 2.0.14

In my case adding Framework didn´t work!
If you have a folder named "magazine" in your "modules" folder:
DELETE IT
It shouldn't be there!



TopTop
« 1 ... 187 188 189 (190)