1891
trabis
Re: Adding avatars to news items??
  • 2006/9/17 15:15

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Yes , I´m using news 1.44. In news 1.15 there is no such funtion. All it´s done in index.php. I did not try it but I think it´s simple. In index.php search for this:
$scount count($sarray);
for ( 
$i 0$i $scount$i++ ) {
    
$story = array();
    
$story['id'] = $sarray[$i]->storyid();
    
$story['poster'] = $sarray[$i]->uname();
    if ( 
$story['poster'] != false ) {
        
$story['poster'] = "<a href='".XOOPS_URL."/userinfo.php?uid=".$sarray[$i]->uid()."'>".$story['poster']."</a>";
    } else {
        
$story['poster'] = $xoopsConfig['anonymous'];
    }


You see that? "$array[$i]->uid()" !!!! Guess it´s the Id of the poster so below the above code paste this:

global $xoopsDB;
$result $array[i$]->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'];


And forget class.newsstory.php

Try it.

I also add in my articles 5 links to articles of the same author! Look in my site Luso-Poemas

The issue of the missing blocks never afeted me. I don´t use them. But i´ll take a look. Bye.
Sorry for the bad english!



1892
trabis
Re: Adding avatars to news items??
  • 2006/9/15 8:38

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


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!



1893
trabis
Re: Adding users vote + user visit counter in your member's profils
  • 2006/9/8 21:44

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


"
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???



1894
trabis
Re: Adding users vote + user visit counter in your member's profils
  • 2006/9/8 11:57

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


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?



1895
trabis
Re: Adding avatars to news items??
  • 2006/9/7 17:15

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


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



1896
trabis
Re: Plenty of modules not working with 2.0.14
  • 2006/9/1 18:18

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


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)



Login

Who's Online

256 user(s) are online (150 user(s) are browsing Support Forums)


Members: 0


Guests: 256


more...

Donat-O-Meter

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

Latest GitHub Commits