Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

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

+- Forum Stats

Members
Total Members: 12358
Latest: KekoWorld
New This Month: 1
New This Week: 2
New Today: 1
Stats
Total Posts: 40082
Total Topics: 7056
Most Online Today: 85
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 2
Guests: 50
Total: 52

Author Topic: Code for ultimate Profile  (Read 11606 times)

0 Members and 1 Guest are viewing this topic.

Offline Draffi

  • Menu Editor Pro Customer
  • Jr. Member
  • *****
  • Posts: 76
    • View Profile
Code for ultimate Profile
« on: May 21, 2013, 02:06:10 pm »
I was trying to add a code-snippet to the "Ultimate-Profile"-Page, using this on:
Code: [Select]
$modSettings['badgeawards_url'] = $boardurl . '/badges/';
  $memberID = $context['member']['id'];     
$badgesCache = array();
if (($badgesCache = cache_get_data('badge_display_' . $memberID, 60)) == null)
{

$result = db_query("
SELECT
b.id_badge, b.title, b.image, b.enabled, l.date
FROM ({$db_prefix}badgeawards_badges as b, {$db_prefix}badgeawards_badge_log as l)
WHERE l.id_badge = b.id_badge AND l.ID_MEMBER = $memberID
ORDER BY l.id_log DESC

", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($result))
{
$badgesCache[] = $row;

}

cache_put_data('badge_display_' . $memberID, $badgesCache, 60);

}

But this gave me an error:
" Call to undefined function db_query()"

Can somebody help me out?

(SMF 2.0.4)

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15042
    • View Profile
Re: Code for ultimate Profile
« Reply #1 on: May 21, 2013, 02:22:59 pm »
Here is SMF 2.0 code for that part
Code: [Select]
global $boardurl,$smcFunc,$modSettings;
 
 $modSettings['badgeawards_url'] = $boardurl . '/badges/';
  $memberID = $context['member']['id'];     
$badgesCache = array();
if (($badgesCache = cache_get_data('badge_display_' . $memberID, 60)) == null)
{

$result = $smcFunc['db_query']('', "
SELECT
b.id_badge, b.title, b.image, b.enabled, l.date
FROM ({db_prefix}badgeawards_badges as b, {db_prefix}badgeawards_badge_log as l)
WHERE l.id_badge = b.id_badge AND l.ID_MEMBER = $memberID
ORDER BY l.id_log DESC

");
while ($row = $smcFunc['db_fetch_assoc']($result))
{
$badgesCache[] = $row;

}

cache_put_data('badge_display_' . $memberID, $badgesCache, 60);

}
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 Draffi

  • Menu Editor Pro Customer
  • Jr. Member
  • *****
  • Posts: 76
    • View Profile
Re: Code for ultimate Profile
« Reply #2 on: May 21, 2013, 02:57:39 pm »
I`m sure, that code is right (no error), but i never see any badges...Or is this only for the new one i will get?

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15042
    • View Profile
Re: Code for ultimate Profile
« Reply #3 on: May 21, 2013, 03:21:13 pm »
Well it needs display code too that code above just pulls the badges.
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 Draffi

  • Menu Editor Pro Customer
  • Jr. Member
  • *****
  • Posts: 76
    • View Profile
Re: Code for ultimate Profile
« Reply #4 on: May 21, 2013, 03:27:16 pm »
Ah...okay. Thank you sir!

(Uiiiii, How can i do this:

Quote
Well it needs display code too that code above just pulls the badges.
)


Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15042
    • View Profile
Re: Code for ultimate Profile
« Reply #5 on: May 24, 2013, 03:59:57 pm »
How do you want the appear? Horizontal/Vertical?
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 Draffi

  • Menu Editor Pro Customer
  • Jr. Member
  • *****
  • Posts: 76
    • View Profile
Re: Code for ultimate Profile
« Reply #6 on: May 24, 2013, 05:22:09 pm »
Horizontal with a table

(taken the mod settings from the Admin-menu -How many shown in post-display)

Offline 420connect

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Re: Code for ultimate Profile
« Reply #7 on: February 06, 2015, 11:44:33 am »
Sorry for bumping this..


I'm also looking to add the block shown below the posters information of their top X badges.

I've tried adding

Code: [Select]
// Badge Awards
global $sourcedir, $modSettings;
if (!empty($modSettings['badgeawards_enable']) && !empty($message['member']['id']))
{

require_once($sourcedir . '/badgeawards2.php');
if (!empty($modSettings['badgeawards_showtotalinposts']))
echo '<br />' . $txt['badge_txt_totalbadges'] .  Badges_TotalMemberCount($message['member']['id']);

if (!empty($modSettings['badgeawards_showinposts']))
{
echo '<br />' . $txt['badge_badges'] . ': <a href="' . $scripturl . '?action=badgeawards;sa=badges;u=' . $message['member']['id'] .'">' . $txt['badge_txt_viewall'] . '</a><br />';
Badges_DisplayBadges($message['member']['id'],'recent',$modSettings['badgeawards_numdisplay']);
}
}

// End Badge Awards

to UltimateProfile.template.php

and if I'm understanding this thread; added

Code: [Select]
[quote author=SMFHacks link=topic=7679.msg32982#msg32982 date=1369164179]
Here is SMF 2.0 code for that part
[code]
 global $boardurl,$smcFunc,$modSettings;
 
 $modSettings['badgeawards_url'] = $boardurl . '/badges/';
  $memberID = $context['member']['id'];     
$badgesCache = array();
if (($badgesCache = cache_get_data('badge_display_' . $memberID, 60)) == null)
{

$result = $smcFunc['db_query']('', "
SELECT
b.id_badge, b.title, b.image, b.enabled, l.date
FROM ({db_prefix}badgeawards_badges as b, {db_prefix}badgeawards_badge_log as l)
WHERE l.id_badge = b.id_badge AND l.ID_MEMBER = $memberID
ORDER BY l.id_log DESC

");
while ($row = $smcFunc['db_fetch_assoc']($result))
{
$badgesCache[] = $row;

}

cache_put_data('badge_display_' . $memberID, $badgesCache, 60);

}
[/quote][/code]

near the top of the UltimateProfile.template.php

but still no sign of any badges appearing?  :o

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15042
    • View Profile
Re: Code for ultimate Profile
« Reply #8 on: February 06, 2015, 11:48:29 am »
$message['member']['id'] in your example should change to $context['member']['id']
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 420connect

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Re: Code for ultimate Profile
« Reply #9 on: February 06, 2015, 11:54:19 am »
Love you!  :-*


Offline 420connect

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Re: Code for ultimate Profile
« Reply #10 on: February 06, 2015, 12:13:29 pm »
similarly,
 to add what I have shown below the message posters about the arcade "champion of.." etc.

could you help me add this to Ultimate Profile

I've added:

Code: [Select]
require_once($sourcedir.'/ArcadeSigsStats_v2.php');
at the top of UltimateProfile.template.php

and

Code: [Select]
arcade_champs_post_profile($message);
where I'd like it shown but no success.. :(

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15042
    • View Profile
Re: Code for ultimate Profile
« Reply #11 on: February 06, 2015, 12:18:12 pm »
Well $message is not part of the profile so that is why it is not working.
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 420connect

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Re: Code for ultimate Profile
« Reply #12 on: February 06, 2015, 01:28:37 pm »
tried

Code: [Select]
arcade_champs_post_profile($message); with lots of different variations but still no luck in getting the actual pop up to work correctly.

I can just get it to show the arcade icon and can't see any code that I would add to input the "Champion of... (3 game icons)" part :(

php gives me headaches  :-[

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
2509 Views
Last post January 19, 2008, 08:32:54 am
by RWL
0 Replies
2585 Views
Last post February 10, 2009, 08:33:34 pm
by bluedevil
1 Replies
2254 Views
Last post August 09, 2011, 08:43:03 pm
by SMFHacks
1 Replies
4143 Views
Last post July 08, 2013, 10:56:10 pm
by SMFHacks
0 Replies
3337 Views
Last post December 02, 2013, 07:58:26 am
by electricwildflower

+- Recent Topics

Only variables should be passed by reference by Zaphod
Today at 11:19:11 am

Cannot install Gallery Pro on SMF 2.1 RC2 by Hatshepsut
March 19, 2020, 12:55:00 am

Newbie questions by SMFHacks
March 08, 2020, 09:28:17 am

Update detect mobile mode PHP5 to PHP7 by Plus
March 05, 2020, 11:19:05 am

Just a hello by Plus
March 05, 2020, 11:05:56 am

Enotify Copyright Problem by SMFHacks
March 04, 2020, 09:21:09 pm

Cannot import by shawnb
March 02, 2020, 12:17:00 pm

Error message with latest SMF 2.1 Github build by Hatshepsut
March 01, 2020, 10:06:10 am

[Mod]Avatars Display Integration by SMFHacks
February 15, 2020, 07:30:47 pm

[Mod]BBC Message Boxes 1.0 by SMFHacks
February 15, 2020, 07:26:46 pm

Powered by EzPortal