Advertisement:

Author Topic: showing theme on profile  (Read 27000 times)

Offline diplomat.

  • SMF Friend
  • Full Member
  • *
  • Posts: 545
  • Gender: Male
  • avidSOUND
    • avidSOUND
showing theme on profile
« on: October 15, 2004, 10:20:08 PM »
say if i wanted to say on everyone's profile what theme they are using, like

Username:      BooBoo
Position:         New Member
Theme/Skin:   Theme name that the member is currently using

how would i do that?


avidSOUND.com: Where Aspiring Musicians Can Be HEARD!

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: showing theme on profile
« Reply #1 on: October 16, 2004, 12:11:12 AM »
This would require some (somewhat minor) modifications in Profile.php.... but it's not that hard...

Find this:
Code: [Select]
$request = db_query("
SELECT value
FROM {$db_prefix}themes
WHERE ID_THEME = " . (int) $user_profile[$memID]['ID_THEME'] . "
AND variable = 'name'
LIMIT 1", __FILE__, __LINE__);
list ($name) = mysql_fetch_row($request);
mysql_free_result($request);

And copy it to just above this comment:

Code: [Select]
// Set the age...
Then add under it (where you just put it, above that same comment) the following:

Code: [Select]
$context['member']['theme'] = array('id' => (int) $user_profile[$memID]['ID_THEME'], 'name' => $name);
You should then be able to access it with:

$context['member']['theme']['name'].

-[Unknown]

Offline † ÐëepÇuT¹ †

  • Jr. Member
  • **
  • Posts: 353
  • Gender: Male
  • YaBBSe
    • x3Generation
Re: showing theme on profile
« Reply #2 on: October 16, 2004, 12:11:48 AM »
You can do that if your admin, go into someones profile and try to edit go into "Look and Layout", quite simple. If you aren't admin, then thats a good question!
Personal Website
x3Generation - gaming
graphics and anime.
 
Favorite Forums
> SimpleMachines Forum
> GamerzPlanet Forums


Offline diplomat.

  • SMF Friend
  • Full Member
  • *
  • Posts: 545
  • Gender: Male
  • avidSOUND
    • avidSOUND
Re: showing theme on profile
« Reply #3 on: October 16, 2004, 12:36:28 AM »
when i do that i get this error

Code: [Select]
Notice: Undefined variable: db_prefix in /var/www/html/forums/Sources/Profile.php on line 901
Code: [Select]
Table 'mytable.themes' doesn't exist
File: /var/www/html/forums/Sources/Profile.php
Line: 904
avidSOUND.com: Where Aspiring Musicians Can Be HEARD!

Offline [Unknown]

  • SMF Friend
  • SMF Master
  • *
  • Posts: 36,102
  • Gender: Male
Re: showing theme on profile
« Reply #4 on: October 16, 2004, 03:06:43 AM »
Darn... replace this:

{$db_prefix}

With this:

$GLOBALS[db_prefix]

-[Unknown]

Offline diplomat.

  • SMF Friend
  • Full Member
  • *
  • Posts: 545
  • Gender: Male
  • avidSOUND
    • avidSOUND
Re: showing theme on profile
« Reply #5 on: October 16, 2004, 11:02:47 AM »
:D :D

thanks alot
avidSOUND.com: Where Aspiring Musicians Can Be HEARD!

Offline Emilie

  • Semi-Newbie
  • *
  • Posts: 35
Re: showing theme on profile
« Reply #6 on: November 07, 2004, 08:10:12 AM »
I'm trying to use this function (which I thought was great) but it doesn't work.

There's no errors (which would mean it works) and the code is in the right place - but when I check someones profile the "theme" part isn't there...

What's wrong?

Offline Oldiesmann

  • Developer
  • SMF Super Hero
  • *
  • Posts: 24,814
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: showing theme on profile
« Reply #7 on: November 08, 2004, 10:19:24 AM »
You need to put $context['member']['theme'] somewhere in Profile.template.php... Just follow the examples already there (copy something and change the appropriate things).
Michael Eshom
Webmaster / SMF Lead Developer
oldiesmann@simplemachines.org

Offline godzirrraaaaa

  • Semi-Newbie
  • *
  • Posts: 18
  • Gender: Female
Re: showing theme on profile
« Reply #8 on: May 21, 2006, 06:29:24 PM »
I get this error when I try this:

2: smf_main(/home/xxxmb/public_html/Sources/Profile.php): failed to open stream: No such file or directory
File: /home/xxxmb/public_html/index.php
Line: 344
Board X [nofollow]

Offline NayNay

  • Semi-Newbie
  • *
  • Posts: 49
Re: showing theme on profile
« Reply #9 on: September 28, 2006, 06:39:20 PM »
Hate to bring up an old thread but will this work with 1.1 RC3?  If not, can someone explain how?

Pratt

  • Guest
Re: showing theme on profile
« Reply #10 on: June 12, 2007, 08:33:40 PM »
Im having a problem with this Tip.

I have done everything said here, but the only thing that is display es the expression: "Array"

SMF 1.2
« Last Edit: June 13, 2007, 06:12:44 PM by Pratt »

Pratt

  • Guest
Re: showing theme on profile
« Reply #11 on: June 17, 2007, 04:54:26 PM »
Any Ideas on how could i resolve this?

Pratt

  • Guest
Re: showing theme on profile
« Reply #12 on: June 19, 2007, 04:17:09 PM »
hmmmm, no one???

Offline codenaught

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,653
  • Gender: Male
  • Formerly Known As akabugeyes
Re: showing theme on profile
« Reply #13 on: June 21, 2007, 07:19:43 PM »
Are you using exactly:

$context['member']['theme']['name']?

And not just something like $context['member']['theme']?
Dev Consultant
Former SMF Doc Coordinator

Pratt

  • Guest
Re: showing theme on profile
« Reply #14 on: June 21, 2007, 09:30:00 PM »
I have tried with both expression with $context['member']['theme']['name'] and with $context['member']['theme'].

When using $context['member']['theme']['name'] i get nothing.. nothing is displayed.
when using  $context['member']['theme'] it prints only the expression "Array"

I guess it could be the output line? Could it be out of date? I found the Code inside the Profile.php and copy it again above de (//set the Age ) and added the line of code explained above ($context['member']['theme'] = array('id' => (int) $user_profile[$memID]['ID_THEME'], 'name' => $name);). I tried with the {$db_prefix} and $GLOBALS[db_prefix]
but still no results :(
« Last Edit: June 21, 2007, 10:04:21 PM by Pratt »

Offline codenaught

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 14,653
  • Gender: Male
  • Formerly Known As akabugeyes
Re: showing theme on profile
« Reply #15 on: June 21, 2007, 11:38:44 PM »
I just tested it for myself.

It only doesn't show something when the user has 'Forum or Board Default' selected for their theme. If you try changing it to another theme, it should show the theme's name, or at least it did for me.

This could easily be fixed by adding some kind of check if $context['member']['theme']['name'] is empty. So something like:

Code: [Select]
if (empty($context['member']['theme']['name']))
echo ' Forum or Board Default';
else
echo $context['member']['theme']['name'];
Dev Consultant
Former SMF Doc Coordinator

Pratt

  • Guest
Re: showing theme on profile
« Reply #16 on: June 22, 2007, 04:32:15 PM »
Oh i see! You are Right! Thank you very much!!!!