Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 4267
Latest: ramiroelliot
New This Month: 2
New This Week: 0
New Today: 0
Stats
Total Posts: 43538
Total Topics: 7565
Most Online Today: 40
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 47
Total: 47

Author Topic: custom modification  (Read 8391 times)

0 Members and 1 Guest are viewing this topic.

Offline exit

  • Bad Emails DO NOT EMAIL
  • Jr. Member
  • *
  • Posts: 92
    • View Profile
custom modification
« 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: [Select]
<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 »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16561
    • View Profile
Re: custom modification
« 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
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline exit

  • Bad Emails DO NOT EMAIL
  • Jr. Member
  • *
  • Posts: 92
    • View Profile
Re: custom modification
« 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: [Select]
$board['ID_MEMBER']['avatar']['image']

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16561
    • View Profile
Re: custom modification
« Reply #3 on: April 25, 2012, 01:30:53 pm »
Last question what SMF version?
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline exit

  • Bad Emails DO NOT EMAIL
  • Jr. Member
  • *
  • Posts: 92
    • View Profile
Re: custom modification
« Reply #4 on: April 25, 2012, 01:44:09 pm »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16561
    • View Profile
Re: custom modification
« Reply #5 on: April 25, 2012, 03:30:54 pm »
Some example code
Code: [Select]
global $memberContext;
$memCommID= $board['ID_MEMBER'];
loadMemberData($memCommID);
loadMemberContext($memCommID);

echo '
<div style="overflow: hidden; width: 100%;">', $memberContext[$memCommID]['avatar']['image'], '</div><br />';
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline exit

  • Bad Emails DO NOT EMAIL
  • Jr. Member
  • *
  • Posts: 92
    • View Profile
Re: custom modification
« 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: [Select]
<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!

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16561
    • View Profile
Re: custom modification
« Reply #7 on: April 30, 2012, 10:46:31 am »
Well change it to.
Code: [Select]
<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>
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline exit

  • Bad Emails DO NOT EMAIL
  • Jr. Member
  • *
  • Posts: 92
    • View Profile
Re: custom modification
« Reply #8 on: April 30, 2012, 01:12:36 pm »
Doesn't work.

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

Code: [Select]
// 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);
}
}
}

Offline exit

  • Bad Emails DO NOT EMAIL
  • Jr. Member
  • *
  • Posts: 92
    • View Profile
Re: custom modification
« 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: [Select]
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;" />'
                  

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 16561
    • View Profile
Re: custom modification
« Reply #10 on: August 04, 2012, 04:36:32 pm »
This line is bad
Code: [Select]
(!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: [Select]
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;" />';
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
6513 Views
Last post October 03, 2007, 06:40:17 pm
by SMFHacks
2 Replies
6604 Views
Last post April 25, 2008, 01:43:52 pm
by adlep
0 Replies
2682 Views
Last post March 12, 2011, 05:21:40 am
by Bocker
0 Replies
2572 Views
Last post September 16, 2013, 01:10:30 pm
by mrbane
12 Replies
2263 Views
Last post June 06, 2022, 09:25:39 pm
by SMFHacks

+- Recent Topics

Gallery Pro reinstalation by Lirorobert
October 06, 2024, 04:16:25 pm

quoting part of message by Lirorobert
October 04, 2024, 03:21:40 pm

Does SMF Gallery support by SMFHacks
October 02, 2024, 06:14:26 am

Restoring a deleted photo by Monocero
September 28, 2024, 04:12:20 am

Item count on Gallery Tab shows double by SMFHacks
September 26, 2024, 12:59:20 pm

Forum post missing when image over 4000x pixels is uploaded to gallery by Michel68
September 24, 2024, 01:37:17 pm

Setting a photo as invisible by Monocero
September 17, 2024, 02:11:56 pm

Two gallery names by SMFHacks
September 15, 2024, 02:17:49 pm

Bar during the regeneration of miniatures by Monocero
September 15, 2024, 12:35:08 pm

Error on upgrade by SMFHacks
September 14, 2024, 09:54:07 pm

Powered by EzPortal