Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Integration with third-party extensions    Topic: Jcomments Avatar Plugin with ZOO image element
Pages: [1]   Go Down
  Print  
Author Topic: Jcomments Avatar Plugin with ZOO image element  (Read 1518 times)
0 Members and 1 Guest are viewing this topic.
ledirlo
Newbie
*

Karma: 0
Offline Offline

Posts: 10


« on: October 25, 2011, 17:52:50 »

I've been setting up user profiles using ZOO and build a small joomla module that displays the user's avatar.

I'm trying to get this to work as well in Jcomments.

I edited the Jcomments.avatar.php and xml files and replaced one of the supported software with ZOO in both files.

I placed this code for ZOO in the Jcomments.avatar.php :
Code:
case 'zoo':
if (count($users)) {
      $db->setQuery( 'SELECT created_by, type, application, id FROM #__zoo_core_item WHERE user_id in (' . implode(',', $users)  . ')');
$where[] = 'created_by = ' . $userid;
$where[] = 'type = ' . 'article-copy-2';
$avatars = $db->loadObjectList('created_by');
            unset($users);
} else {
$avatars = array();
}

$avatarA = $mainframe->getCfg('absolute_path') . DS . 'images' . DS . 'stories' . DS . 'zoo' . DS . 'uploads' ;
$avatarL = $mainframe->getCfg('live_site') . '/images/stories/zoo/uploads/';

for ($i=0,$n=count($comments); $i < $n; $i++) {
$userid = (int) $comments[$i]->userid;

// link to profile
$comments[$i]->profileLink = $userid ? JoomlaTuneRoute::_('index.php?option=com_zoo&Itemid=39&layout=mysubmissions&submission_id=3&view=submission' . $userid) : '';

// avatar
        if (isset($avatars[$userid]) && $avatars[$userid]->avatar != '') {
        if (is_file($avatarA . $avatars[$userid]->avatar)) {
$comments[$i]->avatar = plgJCommentsAvatarImg($avatarL . $avatars[$userid]->avatar);
} else {
$comments[$i]->avatar = '';
}
} else {
$comments[$i]->avatar = '';
        }
}
unset($avatars);
break;

Do you please see something wrong in the db request for the avatar ? the plugin keeps returning the default no avatar picture, the links work though.Thank you
Logged
ledirlo
Newbie
*

Karma: 0
Offline Offline

Posts: 10


« Reply #1 on: November 11, 2011, 04:58:48 »

mmm no one...

I dunno how to echo or display it.

I'll explain :

1 : I built a ZOO category and types I named Profiles

2 : I built a modification of the Zoomodule.php Helper and a mod of the zooitem module : now I have a ZOO module that displays the Avatar uploaded by the viewer in his profile...which I'm VERY happy with.

3: Now I've been trying to integrate those zoo avatars into Jcomment so I have them all over .

it works like this : A ZOO Profile displays elements; elements can be anything; the user image is an element.
It has a specific id .But this element is made of a file ("file") and its attributes.It looks like this in the DB :
Code:
"1460640d-b051-4eb7-a03a-9e227f444113":  {
"file": "images\/stories\/zoo\/uploads\/bruce_willis_1.jpg.html.jpeg",
"title": "",
"link": "",
"target": "0",
"rel": "",
"width": 600,
"height": 800
}
   where the long figure "1460640D...Etc" means "image element" to ZOO.

Now the part I'm trying to get from the db and display correctly in the Jcomments avatar plugin is the "file".

so I tried this :
Code:
if (count($users)) {
$db->setQuery( 'SELECT * FROM zoo_table_item LIMIT 0, 30 WHERE created_by in (' . implode(',', $users)  . ') AND type = article-copy-2 ');
$where[] = 'elements ' == '1460640d-b051-4eb7-a03a-9e227f444113'.$created_by;
$db->LoadObject('file' );
       
$where[] = 'created_by='.$userid;      
     
$avatars = $db->loadObjectList('created_by'); } else {
$avatars = array();
}

$avatarA = $mainframe->getCfg('absolute_path') . DS . 'images' . DS . 'stories' . DS . 'zoo' . DS . 'uploads' ;
$avatarL = $mainframe->getCfg('live_site') . '/images/stories/zoo/uploads/';

// link to profile
$comments[$i]->profileLink = $userid ? JoomlaTuneRoute::_('index.php?option=com_zoo&Itemid=39&layout=mysubmissions&submission_id=3&view=submission' . $userid) : '';

// avatar
       if (isset($avatars[$userid]) && $avatars[$userid]->avatar != 'file'.$userid) {
        if (is_file($avatarA . $avatars[$userid]->avatar)) {
$comments[$i]->avatar =  'file'.$userid->avatar;
} else {
$comments[$i]->avatar =  'file'.$userid->avatar;
}
} else {
$comments[$i]->avatar =  '"file":'.$userid->avatar;
       }
}
unset($avatars);


...and I can't get the file to display; all I get is the word "file" echoed instead of the avatar.

I know this is some lecture but if someone wants to cooperate on this I can provide you with my zoo avatar module and the whole thing makes an awesome joomla integration : user profiles built in zoo with no further need of another component.
I ask here because I must admit I do not understand the way you code for I'm not actually a coder ...I tried and it worked
in advance, thank you very much

« Last Edit: November 11, 2011, 05:01:04 by ledirlo » Logged
ledirlo
Newbie
*

Karma: 0
Offline Offline

Posts: 10


« Reply #2 on: November 11, 2011, 16:34:20 »

I mention the zoo module I developed is basically a zoo item module that allows user specific content to be filtered and displayed- I did not publish it in the joomla extensions directory because it seems too complicated to me
Logged
dollin
Newbie
*

Karma: 0
Offline Offline

Posts: 3


Email
« Reply #3 on: December 26, 2011, 10:59:04 »

From what I can see, it seems that the zoo module you had indeed developed is a zoo item module. I too have had encounters with the zoo module. Although it is one of the best in filtering and displaying user specific content, it is pretty much complicated and confusing for most Joomla users.

_______________________________
I need some help for my online file storage programings, anyone can do that?
« Last Edit: January 03, 2012, 21:15:44 by dollin » Logged
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Integration with third-party extensions    Topic: Jcomments Avatar Plugin with ZOO image element
 
Jump to: