Facebook  Twitter 

SMFHacks.com

+-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 4255
Latest: andreios
New This Month: 3
New This Week: 1
New Today: 0
Stats
Total Posts: 43261
Total Topics: 7519
Most Online Today: 297
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 2
Guests: 284
Total: 286

Author Topic: custom modification  (Read 8091 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: 16436
    • 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: 16436
    • 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: 16436
    • 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: 16436
    • 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: 16436
    • 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
6361 Views
Last post October 03, 2007, 06:40:17 pm
by SMFHacks
2 Replies
6526 Views
Last post April 25, 2008, 01:43:52 pm
by adlep
0 Replies
2629 Views
Last post March 12, 2011, 05:21:40 am
by Bocker
0 Replies
2524 Views
Last post September 16, 2013, 01:10:30 pm
by mrbane
12 Replies
1747 Views
Last post June 06, 2022, 09:25:39 pm
by SMFHacks

+- Recent Topics

Problems SMF 2.0.19 > 2.1.4 SMF Gallery Pro - Recents Images to overall header by Michel68
Today at 08:27:36 am

No thumbnails on new uploads by Tonyvic
Today at 06:26:18 am

Display the Contact Page for guests by SMFHacks
March 27, 2024, 10:55:43 am

is it possible to add support for odysee.com by fvlog19
March 21, 2024, 08:47:51 am

Request for admin notification by davejo
March 10, 2024, 01:31:59 am

I need help with torrent upload by Ineedsmfhelp
March 09, 2024, 10:01:13 pm

an idea for new mod (( content type with different display )) by SMFHacks
February 27, 2024, 01:36:27 pm

[Mod] RSS Feed Poster by SMFHacks
February 27, 2024, 11:57:18 am

find duplicate pictures by fvlog19
February 14, 2024, 02:22:40 pm

Error uploading video. by SMFHacks
February 08, 2024, 02:04:16 pm

Powered by EzPortal