Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4220
Latest: agolac
New This Month: 1
New This Week: 1
New Today: 0
Stats
Total Posts: 42854
Total Topics: 7464
Most Online Today: 86
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 44
Total: 44

Author Topic: custom modification  (Read 7372 times)

0 Members and 1 Guest are viewing this topic.

Offline exit

  • 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: 16257
    • 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

  • 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: 16257
    • 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

  • 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: 16257
    • 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

  • 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: 16257
    • 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

  • 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

  • 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: 16257
    • 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
5721 Views
Last post October 03, 2007, 06:40:17 pm
by SMFHacks
2 Replies
6030 Views
Last post April 25, 2008, 01:43:52 pm
by adlep
0 Replies
2139 Views
Last post March 12, 2011, 05:21:40 am
by Bocker
0 Replies
2051 Views
Last post September 16, 2013, 01:10:30 pm
by mrbane
12 Replies
967 Views
Last post June 06, 2022, 09:25:39 pm
by SMFHacks

+- Recent Topics

Is the PayPal Sandbox still working? by Nicole
June 02, 2023, 06:51:18 am

Question on Completed Listing & Reserve Price by Nicole
June 01, 2023, 06:06:12 pm

[Mod]GDPR Helper by Nicole
May 29, 2023, 11:58:49 pm

RSS Feed Poster Database Error by SMFHacks
May 22, 2023, 06:26:18 pm

Errors With Older Version. by Ken.
May 09, 2023, 05:35:40 pm

Pretty Urls SEO Pro by SMFHacks
May 06, 2023, 03:30:11 pm

New Post Image Upload Error by Mike66
April 28, 2023, 07:30:28 am

Copyright Removal Key by SMFHacks
April 03, 2023, 02:44:28 pm

Converting from Aeva Media by sudhakar
April 02, 2023, 11:09:54 am

Using SMF's Built-in Search Algorithm by shuban
March 27, 2023, 09:15:10 am

Powered by EzPortal