News:

Wondering if this will always be free?  See why free is better.

Main Menu

Can you display regular group and post count group icons?

Started by maxjam, October 04, 2011, 10:55:07 AM

Previous topic - Next topic

maxjam

Hi

Is there anyway to display both Regular Group members and Post Count Group members at the same time?

I have set up my Regular Group to display Guild rank and the Post Count Group to display forum rank to give the overall effect of an Imperial Rank Insignia on my Star Wars forums. But I can't seem to get them both to display at the same time.

The best I can do is to show guild rank (text) forum rank (text) and either guild rank icons or forum rank icons, not both at the same time.

Any help or advice would be appreciated.

Thanks!

EDIT : using SMF 2.0.1 (www.mandalorianforge.com)

Oldiesmann

Yep. It requires some slight modification though.

Sources/Load.php

Find
CASE WHEN mem.id_group = 0 OR mg.stars = {string:blank_string} THEN pg.stars ELSE mg.stars END AS stars' . (!empty($modSettings['titlesEnable']) ? ',

Add before that
CASE WHEN mem.id_group = 0 THEN {string:blank_string} ELSE mg.stars END AS mg_stars, pg.stars AS pg_stars,

Find
pg.online_color AS post_group_color, IFNULL(pg.group_name, {string:blank_string}) AS post_group, mem.ignore_boards, mem.warning,

Add after that
CASE WHEN mem.id_group = 0 THEN {string:blank_string} ELSE mg.stars END AS mg_stars, pg.stars AS pg_stars,

Find
if (!empty($row['stars']))
$user_profile[$id]['stars'] = $row['stars'];


Replace
if (!empty($row['stars']))
{
$user_profile[$id]['stars'] = $row['stars'];
$user_profile[$id]['mg_stars'] = $row['stars'];
}


Find
$profile['stars'] = empty($profile['stars']) ? array('', '') : explode('#', $profile['stars']);

Add after that
$profile['mg_stars'] = empty($profile['mg_stars']) ? array('', '') : explode('#', $profile['mg_stars']);
$profile['pg_stars'] = empty($profile['pg_stars']) ? array('', '') : explode('#', $profile['pg_stars']);


Find
'group_stars' => str_repeat('<img src="' . str_replace('$language', $context['user']['language'], isset($profile['stars'][1]) ? $settings['images_url'] . '/' . $profile['stars'][1] : '') . '" alt="*" />', empty($profile['stars'][0]) || empty($profile['stars'][1]) ? 0 : $profile['stars'][0]),

Add after that
'mg_stars' => empty($profile['mg_stars']) ? '' : str_repeat('<img src="' . str_replace('$language', $context['user']['language'], isset($profile['mg_stars'][1]) ? $settings['images_url'] . '/' . $profile['mg_stars'][1] : '') . '" alt="*" />', empty($profile['mg_stars'][0]) || empty($profile['mg_stars'][1]) ? 0 : $profile['mg_stars'][0]),
'pg_stars' => str_repeat('<img src="' . str_replace('$language', $context['user']['language'], isset($profile['pg_stars'][1]) ? $settings['images_url'] . '/' . $profile['pg_stars'][1] : '') . '" alt="*" />', empty($profile['pg_stars'][0]) || empty($profile['pg_stars'][1]) ? 0 : $profile['pg_stars'][0]),


Themes/default/Display.template.php

Find
echo '
<li class="stars">', $message['member']['group_stars'], '</li>';


Replace
if (!empty($message['member']['mg_stars']))
{
echo '
<li class="stars">', $message['member']['mg_stars'], '</li>';
}
echo '
<li class="stars">', $message['member']['pg_stars'], '</li>';


That should do the trick, at least for posts. If you want it displayed like that in other places as well, you'll have to make similar changes to the other templates.
Michael Eshom
Christian Metal Fans

maxjam

I have done all of the above and uploaded the files but nothing has changed (still showing just 1 row of icons).

I am however using the SWTOR Black theme, do I need to do anything else?

Thanks :)

EDIT : Just deleted my cache too, to ensure any changes took effect but still no luck.

maxjam

Can anyone shed any light on what else I need to do?

It feels like I am so near, yet so far!!!

Thanks

Suki

If your theme also has its own Display.template.php  then you need to do the edits to that file too
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

maxjam

Yeah I'd thought of that already but couldn't find one.

Just double checked and still can't find one!

Suki

your theme doesn't have a Display.template.php ?

it should be on /Themes/your theme name/
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

maxjam

Nope :(

Themes/SWTORBlack/ (presents me with the following options)

css folder (not in there)
images folder (not in there)
scripts folder (not in there)
index.php
index.template.php
settings.template.php
theme_info.xml

I guess it could be one of the others, but I wouldn't know what I was looking for

Suki

can you attach your Themes/default/Display.template.php here.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

maxjam

/sigh

Just spotted my error. There are two Display.template.php folders (.php and .php~) and I amended the wrong one. Just changed the other one and both sets of icons are now displaying on my forum :)

Quick question, should I revert the .php~ file back to its original state as it doesn't seem to have caused any problems.

Thanks for your help both :)

Suki

the .php~  its a back up file, it is created when a mod modifies a file, you can leave it as it is since it doesn't affect your forum at all.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

braddasexy

#11
Would the same apply if I have Post Count Groups and Private Member Group?  I want to display the Icon from both of those groups.

Edit:  Same with an Admin, can it show the Icons from all the groups the Admin belongs to?

Illori

please open a separate thread for your issue this thread belongs to someone else and is marked solved. also please dont bump old threads.

maxjam

*****  UPDATE MARCH 2013  *****


Quote from: Oldiesmann on October 04, 2011, 11:43:57 AM
Yep. It requires some slight modification though.

Sources/Load.php

Find
CASE WHEN mem.id_group = 0 OR mg.stars = {string:blank_string} THEN pg.stars ELSE mg.stars END AS stars' . (!empty($modSettings['titlesEnable']) ? ',

Add before that
CASE WHEN mem.id_group = 0 THEN {string:blank_string} ELSE mg.stars END AS mg_stars, pg.stars AS pg_stars,

Find
pg.online_color AS post_group_color, IFNULL(pg.group_name, {string:blank_string}) AS post_group, mem.ignore_boards, mem.warning,

Add after that
CASE WHEN mem.id_group = 0 THEN {string:blank_string} ELSE mg.stars END AS mg_stars, pg.stars AS pg_stars,

Find
if (!empty($row['stars']))
$user_profile[$id]['stars'] = $row['stars'];


Replace
if (!empty($row['stars']))
{
$user_profile[$id]['stars'] = $row['stars'];
$user_profile[$id]['mg_stars'] = $row['stars'];
}


Find
$profile['stars'] = empty($profile['stars']) ? array('', '') : explode('#', $profile['stars']);

Add after that
$profile['mg_stars'] = empty($profile['mg_stars']) ? array('', '') : explode('#', $profile['mg_stars']);
$profile['pg_stars'] = empty($profile['pg_stars']) ? array('', '') : explode('#', $profile['pg_stars']);


Find
'group_stars' => str_repeat('<img src="' . str_replace('$language', $context['user']['language'], isset($profile['stars'][1]) ? $settings['images_url'] . '/' . $profile['stars'][1] : '') . '" alt="*" />', empty($profile['stars'][0]) || empty($profile['stars'][1]) ? 0 : $profile['stars'][0]),

Add after that
'mg_stars' => empty($profile['mg_stars']) ? '' : str_repeat('<img src="' . str_replace('$language', $context['user']['language'], isset($profile['mg_stars'][1]) ? $settings['images_url'] . '/' . $profile['mg_stars'][1] : '') . '" alt="*" />', empty($profile['mg_stars'][0]) || empty($profile['mg_stars'][1]) ? 0 : $profile['mg_stars'][0]),
'pg_stars' => str_repeat('<img src="' . str_replace('$language', $context['user']['language'], isset($profile['pg_stars'][1]) ? $settings['images_url'] . '/' . $profile['pg_stars'][1] : '') . '" alt="*" />', empty($profile['pg_stars'][0]) || empty($profile['pg_stars'][1]) ? 0 : $profile['pg_stars'][0]),


Themes/default/Display.template.php

Find
echo '
<li class="stars">', $message['member']['group_stars'], '</li>';


Replace
if (!empty($message['member']['mg_stars']))
{
echo '
<li class="stars">', $message['member']['mg_stars'], '</li>';
}
echo '
<li class="stars">', $message['member']['pg_stars'], '</li>';




I have just tried to do this again on a new install of smf 2.0.4;

I can still find the code in Sources/Load.php and make the necessary changes but I can't find the code in the Themes/default/Display.template.php folder - has this changed and can anyone help me out please?

To recap my problem, I am trying to display member stars for both Regular Groups and Post Count Based Groups.

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

maxjam

Just installed that mod tyvm and it seems to be working despite a couple of Test Failed errors.  ( Link to image: http://tinypic.com/view.php?pic=2ni6zj7&s=6  )

The mod does (for my needs at least) display the Membergroup stars in the wrong order.  It displays the Post Count stars under Regular Group title and Regular Group stars under the Post Count title.

Kindred

if you got test failed messages, then you need to fix it.  That's why those messages tell you exactly what code needs to be changed or added.
http://wiki.simplemachines.org/smf/Error_in_mod_installation
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

maxjam

Yeah, I had a look but its beyond my capabilities :(


It can't find
<li class="membergroup">', $message['member']['group'], '</li>';

This needs to go after it

$context['membergroup']['id'] = !empty($modSettings['starsByGroup_array']) ? explode(',', $modSettings['starsByGroup_array'], 20) : '';

if (!empty($context['membergroup']['id']) && in_array ($message['member']['group_id'], $context['membergroup']['id']))
echo '
<li class="membergroup">', $message['member']['additional_group_stars'], '</li>';



In ./Themes/core/Display.template.php

kat

Neither can I. I wonder if they mean this block of code, in the same file in the default theme's directory?


// Show the member's primary group (like 'Administrator') if they have one.
if (!empty($message['member']['group']))
echo '
<li class="membergroup">', $message['member']['group'], '</li>';


Advertisement: