Twitter SMFHacks Facebook SMFHacks SMFHacks.com
** Home Forum Index Hacks Products Login Register Search
Welcome, Guest. Please login or register.
June 19, 2013, 10:58:28 pm

Login with username, password and session length
Members
Total Members: 10807
Latest: GoldDigger1950
Stats
Total Posts: 32568
Total Topics: 5509
Online Today: 58
Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Users: 0
Guests: 35
Total: 35
+ 
|-+ 
| |-+ 
| | |-+ 
| | | |-+ 
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: custom modification  (Read 1806 times)
exit
Jr. Member
**
Offline Offline

Posts: 64


View Profile
« on: April 25, 2012, 12:40:00 pm »

I'm trying to adapt the boardindex categories to my custom theme, and I'm not able to get user avatar from the classifieds...

What is wrong in this code

Code:
<a href="',$scripturl,'?action=miniprofile;u='.$board['ID_MEMBER'].'" rel="width:560,height:260" id="mb'.$board['id'].'" class="mb">
<img alt=""  class="avyframe" style="width: 50px;height: 50px;border-radius:3px;" src="' . (!empty($avvy[$board['ID_MEMBER']]) ? $avvy[$board['ID_MEMBER']] : $settings['images_url'].'/TPguest.png') . '" />
</a>

Thanks
« Last Edit: April 25, 2012, 12:43:35 pm by exit » Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 11056


View Profile
« Reply #1 on: April 25, 2012, 12:52:19 pm »

The $board variable probably does not contain the member id do a print_r($board);
And see what it outputs
Logged
exit
Jr. Member
**
Offline Offline

Posts: 64


View Profile
« Reply #2 on: April 25, 2012, 01:03:46 pm »

The $board variable probably does not contain the member id do a print_r($board);
And see what it outputs

It contains the member id, but how do I get the user avatar? That's my goal... This doesn't work:
Code:
$board['ID_MEMBER']['avatar']['image']

Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 11056


View Profile
« Reply #3 on: April 25, 2012, 01:30:53 pm »

Last question what SMF version?
Logged
exit
Jr. Member
**
Offline Offline

Posts: 64


View Profile
« Reply #4 on: April 25, 2012, 01:44:09 pm »

Last question what SMF version?

2
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 11056


View Profile
« Reply #5 on: April 25, 2012, 03:30:54 pm »

Some example code
Code:
global $memberContext;
$memCommID= $board['ID_MEMBER'];
loadMemberData($memCommID);
loadMemberContext($memCommID);

echo '
<div style="overflow: hidden; width: 100%;">', $memberContext[$memCommID]['avatar']['image'], '</div><br />';
Logged
exit
Jr. Member
**
Offline Offline

Posts: 64


View Profile
« Reply #6 on: April 30, 2012, 10:00:10 am »

Can u be more specific?

For instance how to aplly that on this code?
Code:
<a href="',$scripturl,'?action=miniprofile;u='.$board['ID_MEMBER'].'" rel="width:560,height:260" id="mb'.$board['id'].'" class="mb">
<img alt=""  class="avyframe" style="width: 50px;height: 50px;border-radius:3px;" src="' . (!empty($avvy[$board['ID_MEMBER']]) ? $avvy[$board['ID_MEMBER']] : $settings['images_url'].'/TPguest.png') . '" />
</a>

Sorry and thanks!
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 11056


View Profile
« Reply #7 on: April 30, 2012, 10:46:31 am »

Well change it to.
Code:
<a href="',$scripturl,'?action=miniprofile;u='.$board['ID_MEMBER'].'" rel="width:560,height:260" id="mb'.$board['id'].'" class="mb">';

global $memberContext;
$memCommID= $board['ID_MEMBER'];
loadMemberData($memCommID);
loadMemberContext($memCommID);

echo '
<img alt=""  class="avyframe" style="width: 50px;height: 50px;border-radius:3px;" src="' . (!empty($board['ID_MEMBER']) ? $memberContext[$memCommID]['avatar']['image'] : $settings['images_url'].'/TPguest.png') . '" />
</a>
Logged
exit
Jr. Member
**
Offline Offline

Posts: 64


View Profile
« Reply #8 on: April 30, 2012, 01:12:36 pm »

Doesn't work.

I'm using this to get the avatarts...

Code:
// if avatars are to be fetched
if(!empty($settings['avatarboards']))
{
// fetch last posters
$membs = array();
foreach($context['categories'] as $category)
{
if(!empty($category['boards']))
{
foreach($category['boards'] as $b)
$membs[$b['last_post']['member']['id']] = $b['last_post']['member']['id'];
}
}
if(count($membs)>0)
{
$request =  $smcFunc['db_query']('','SELECT mem.id_member as ID_MEMBER, mem.avatar,
IFNULL(a.id_attach, 0) AS ID_ATTACH, a.filename, a.attachment_type as attachmentType
FROM ' . $db_prefix . 'members AS mem
LEFT JOIN ' . $db_prefix . 'attachments AS a ON (a.id_member = mem.id_member)
WHERE mem.id_member IN (' . implode(",",$membs) . ')',array());

$avvy = array();
if($smcFunc['db_num_rows']($request)>0)
{
while($row = $smcFunc['db_fetch_assoc']($request))
$avvy[$row['ID_MEMBER']] = $row['avatar'] == '' ? ($row['ID_ATTACH'] > 0 ? (empty($row['attachmentType']) ? $scripturl . '?action=dlattach;attach=' . $row['ID_ATTACH'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' . htmlspecialchars($row['avatar']));

$smcFunc['db_free_result']($request);
}
}
}
Logged
exit
Jr. Member
**
Offline Offline

Posts: 64


View Profile
« Reply #9 on: August 04, 2012, 07:29:24 am »

Backing to this topic...

I'm having a php template error, what is wrong in the code?

Code:
global $memberContext;
$memCommID= $board['ID_MEMBER'];
loadMemberData($memCommID);
loadMemberContext($memCommID);

 (!empty($board['ID_MEMBER']) ? $memberContext[$memCommID]['avatar']['image'] : '<img src="'.$settings['images_url'].'/TPguest.png" class="avyframe" style="width: 50px;height: 50px;border-radius:3px;" />'
                  
Logged
SMFHacks
Administrator
Hero Member
*****
Offline Offline

Posts: 11056


View Profile
« Reply #10 on: August 04, 2012, 04:36:32 pm »

This line is bad
Code:
(!empty($board['ID_MEMBER']) ? $memberContext[$memCommID]['avatar']['image'] : '<img src="'.$settings['images_url'].'/TPguest.png" class="avyframe" style="width: 50px;height: 50px;border-radius:3px;" />'

Should probably be but looks like you have a lot of stuff that might be invalid in it.
Code:
echo  (!empty($board['ID_MEMBER']) ? $memberContext[$memCommID]['avatar']['image'] : '<img src="'.$settings['images_url'].'/TPguest.png" class="avyframe" style="width: 50px;height: 50px;border-radius:3px;" />';
Logged
Pages: [1] Go Up Print 
« previous next »
Jump to:  

Recent
[Today at 10:08:41 pm]

[Today at 10:08:05 pm]

[Today at 10:06:16 pm]

[Today at 07:25:45 pm]

[Today at 07:19:48 pm]

[Today at 01:36:26 pm]

[June 18, 2013, 07:27:33 am]

[June 17, 2013, 12:27:50 pm]

[June 16, 2013, 08:17:21 pm]

[June 15, 2013, 08:34:38 pm]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
TinyPortal v0.9.7 © Bloc
SMF and SimpleMachines are registered trademarks of Simple Machines. SMFHacks.com is not affiliated with nor endorsed by Simple Machines.
Page created in 1.295 seconds with 18 queries.