SMFHacks.com
SMFHacks
Community Suite
SMF Gallery Pro
SMF Store
SMF Classifieds
Newsletter Pro
Downloads System Pro
Ad Seller Pro
Badge Awards
Hacks and Mods
Latest SMF Hacks
TopTen Hacks
Styles and Themes
Add a Hack
Manage Hacks
Earn Money from Your Forum with these tips
SMF Theme Generator
SMF Package Parser
Free SMF Hosting
Buy Website Traffic
Site Showcase
Email Marketing Software
Search Forums
Advanced search
User
Welcome,
Guest
. Please
login
or
register
.
June 19, 2013, 10:58:28 pm
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Stats
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
SMFHacks.com
Forum
SMF Classifieds
Support
custom modification
0 Members and 1 Guest are viewing this topic.
« previous
next »
Pages:
[
1
]
Author
Topic: custom modification (Read 1806 times)
exit
Jr. Member
Offline
Posts: 64
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:
<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
Posts: 11056
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
Logged
exit
Jr. Member
Offline
Posts: 64
Re: custom modification
«
Reply #2 on:
April 25, 2012, 01:03:46 pm »
Quote from: SMFHacks 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
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
Posts: 11056
Re: custom modification
«
Reply #3 on:
April 25, 2012, 01:30:53 pm »
Last question what SMF version?
Logged
exit
Jr. Member
Offline
Posts: 64
Re: custom modification
«
Reply #4 on:
April 25, 2012, 01:44:09 pm »
Quote from: SMFHacks on April 25, 2012, 01:30:53 pm
Last question what SMF version?
2
Logged
SMFHacks
Administrator
Hero Member
Offline
Posts: 11056
Re: custom modification
«
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
Posts: 64
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:
<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
Posts: 11056
Re: custom modification
«
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
Posts: 64
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:
// 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
Posts: 64
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:
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
Posts: 11056
Re: custom modification
«
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
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
SMFHacks.com
-----------------------------
=> News
=> Site Discussion
===> Suggestions
===> Bugs
-----------------------------
SMF Gallery Pro
-----------------------------
=> Announcements
=> Presales
=> Support
===> Bugs
===> Feature Requests
-----------------------------
SMF Store
-----------------------------
=> Announcements
=> Presales
=> Support
===> Guides and Tips
===> Feature Requests
===> Bugs
-----------------------------
SMF Classifieds
-----------------------------
=> Announcements
=> Presales
=> Support
===> Bugs
===> Feature Requests
-----------------------------
Downloads System Pro
-----------------------------
=> Announcements
=> Presales
=> Support
===> Feature Requests
===> Bugs
-----------------------------
Ad Seller Pro
-----------------------------
=> Presales
=> Support
-----------------------------
Menu Editor Pro
-----------------------------
=> Presales Menu Editor Pro
=> Bug Reports
-----------------------------
Inline Personal Messages
-----------------------------
=> Presales
=> Support
=> Bug Reports
-----------------------------
Newsletter Pro
-----------------------------
=> Presales
=> Support
===> Feature Requests
-----------------------------
Badge Awards
-----------------------------
=> Presales
=> Support
-----------------------------
Tweet Topics/FB Post System
-----------------------------
=> Presales
-----------------------------
Social Login Pro
-----------------------------
=> Presales
-----------------------------
SMF Gallery Lite
-----------------------------
=> SMF Gallery Lite
-----------------------------
Modifications/Themes
-----------------------------
=> General SMF Forum
=> Modifications Talk
===> Latest Mods
===> Modification Showcase
=> Theme Talk
===> Theme Showcase
===> Latest Themes
Recent
Feature Requests for SMF ...
by
SMFHacks
[
Today
at 10:08:41 pm]
A few problems with Ad Se...
by
SMFHacks
[
Today
at 10:08:05 pm]
Showing Badge Icons on Bo...
by
SMFHacks
[
Today
at 10:06:16 pm]
Badge block
by
SMFHacks
[
Today
at 07:25:45 pm]
Rebadging after install
by
SMFHacks
[
Today
at 07:19:48 pm]
WhatÄs this?
by
Labradoodle-360
[
Today
at 01:36:26 pm]
Can "Ad Seller Pro" do it...
by
SMFHacks
[June 18, 2013, 07:27:33 am]
paid auctions
by
SMFHacks
[June 17, 2013, 12:27:50 pm]
Wow
by
Nicole
[June 16, 2013, 08:17:21 pm]
Modification allowing Adm...
by
AcEAndroid
[June 15, 2013, 08:34:38 pm]
Random Picture
Donate to SMFHacks.com
Help Support the SMFHacks.com mod making.
Loading...