showing theme on profile

Started by diplomat., October 15, 2004, 10:20:08 PM

Previous topic - Next topic

diplomat.

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!

[Unknown]

This would require some (somewhat minor) modifications in Profile.php.... but it's not that hard...

Find this:

$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:

// Set the age...

Then add under it (where you just put it, above that same comment) the following:

$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]

† ÐëepÇuT¹ †

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


diplomat.

when i do that i get this error

Notice: Undefined variable: db_prefix in /var/www/html/forums/Sources/Profile.php on line 901

Table 'mytable.themes' doesn't exist
File: /var/www/html/forums/Sources/Profile.php
Line: 904
avidSOUND.com: Where Aspiring Musicians Can Be HEARD!

[Unknown]

Darn... replace this:

{$db_prefix}

With this:

$GLOBALS[db_prefix]

-[Unknown]

diplomat.

avidSOUND.com: Where Aspiring Musicians Can Be HEARD!

Emilie

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?

Oldiesmann

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
Christian Metal Fans

godzirrraaaaa

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]

NayNay

Hate to bring up an old thread but will this work with 1.1 RC3?  If not, can someone explain how?

Pratt

#10
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

Pratt

Any Ideas on how could i resolve this?

Pratt


codenaught

Are you using exactly:

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

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

Pratt

#14
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 :(

codenaught

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:

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

Pratt

Oh i see! You are Right! Thank you very much!!!!

Advertisement: