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?
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]
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!
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
Darn... replace this:
{$db_prefix}
With this:
$GLOBALS[db_prefix]
-[Unknown]
:D :D
thanks alot
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?
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).
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
Hate to bring up an old thread but will this work with 1.1 RC3? If not, can someone explain how?
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
Any Ideas on how could i resolve this?
hmmmm, no one???
Are you using exactly:
$context['member']['theme']['name']?
And not just something like $context['member']['theme']?
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 :(
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'];
Oh i see! You are Right! Thank you very much!!!!