How to - Multiple membergroups shown on post page...

Started by MoreBloodWine, January 03, 2008, 03:44:25 AM

Previous topic - Next topic

MoreBloodWine

See the below pic, well thats from a test forum of mine... Anyway, I made myself a member of a 2nd group called " Co. GM "... not that I need to because I'm the admin but anyway. What would I need to modify to get the 2nd group show below my name / above the administrator tag... hope this makes sense.... Thx.



Edit : What I'm after is leaving everything as it is now BUT getting the second group ( Co. GM ) to show below my username but above the ( Administrator ) tag.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


!Hachi!

NAME
newbie
administrator
i think you want this.REMEMBER I DON'T LIKE TO EDIT TEMPLATE FILES IF YOU WANT TO INSTALL MOD AFTERWARDS IT MIGHT GIVES ERROR SO TAKE BACKUP FILE FIRST.
open you theme display.template.php
search for
// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';

// Don't show these things for guests.
if (!$message['member']['is_guest'])
{
// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
echo '
', $message['member']['post_group'], '<br />';
echo '
', $message['member']['group_stars'], '<br />';


Replace it with:
// Don't show these things for guests.
if (!$message['member']['is_guest'])
{
// Show the post group if and only if they have no other group or the option is on, and they are in a post group.
if ((empty($settings['hide_post_group']) || $message['member']['group'] == '') && $message['member']['post_group'] != '')
echo '
', $message['member']['post_group'], '<br />';
// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';
echo '
', $message['member']['group_stars'], '<br />';
Happy Ramadan

MoreBloodWine

Didnt do a thing as far as I could tell... Hope someone wil read this and get what it is that I am after.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


greyknight17

Are you using the default theme or a custom one? If custom one and they have their own Display.template.php, you will have to edit that one instead.

If you did and still no changes, can you tell us what you want specifically? Something like this:

Your Name
Co. GM
Administrator

If so, that code posted above should work.

DMV

I have the display additional membergroups mod, using the default theme

The dilemna is that it only display ONE group in the post/topic...

Is there a way to have it display all of a members' membergroups

Similar to the first post, but have

Name
"newbie"
Group 1
Group 2
Group 3

along with the "star image" for each particular group?
(I don't care what the order is, my main goal is just to have each membergroup shown in the users' posts)

Thanks in advance...

MoreBloodWine

#5
Quote from: greyknight17 on January 03, 2008, 05:20:24 PM
Are you using the default theme or a custom one? If custom one and they have their own Display.template.php, you will have to edit that one instead.

If you did and still no changes, can you tell us what you want specifically? Something like this:

Your Name
Co. GM
Administrator

If so, that code posted above should work.
Custom theme I edited the right files and unless I screwed up which I know I didnt it didnt work... but yes thats what I am after... everything staying as is now with the one exception that Co. GM now shows up.

Your Name
Co. GM
Administrator

BUT I want Co. GM to adhere to the color I have set in the membergroup... I used HTML around the name plate area to change the text color of Co. GM if that makes sense.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


greyknight17

DMV, I would post your question in that mod's topic to see if anyone knows how to show more than one membergroup in a user's post.

MoreBloodWine, there was a mod that displayed the membergroup color in each post, but it's outdated now. What theme are you using? Did your custom theme have the Display.template.php? Attach that file here.

MoreBloodWine

#7
Quote from: greyknight17 on January 03, 2008, 09:19:54 PM
DMV, I would post your question in that mod's topic to see if anyone knows how to show more than one membergroup in a user's post.

MoreBloodWine, there was a mod that displayed the membergroup color in each post, but it's outdated now. What theme are you using? Did your custom theme have the Display.template.php? Attach that file here.
I have a custom theme... like I said all I want it to do is what its doing now but show the Co. GM tag below my name but above the Administrator tag... so best I can figure is the code that displays the administrator tag on the post page would have to be exactly duplicated but told to grab the Co. GM group but have the code placed above the administrator code so it shows the Co. GM where I want it (above admin but below my name). Also I'd prefer to do the modifications myself... as for testing it to see if it can be done all you or anyone would have to do is copy your file make a second group asign yourself to it and go from there.

Edit:

Best I can figure this is the code that needs to be duplicated / told to grab the Co. GM group...

// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';


So it should look like below BUT the first set of code modified / told to grab the Co. GM group which is NOT a post based group...

// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';

// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


!Hachi!

well sorry if i misunderstood i get this on default theme as i told you codes in my post.

Note COMMANDER is post based group and admin is my primary
Happy Ramadan

MoreBloodWine

#9
Quote from: Hassan on January 03, 2008, 11:50:38 PM
well sorry if i misunderstood i get this on default theme as i told you codes in my post.

Note COMMANDER is post based group and admin is my primary
But the post based group is NOT what I want changed / moved...

Edit:

The pic below shows which group (one with the arrow pointing to it) that I want to show above the admin tag but below my name on the post page when viewing posts... so we already know that the Display.template.php is what needs to be modified...



So with that said I go back to an earlier post of mine...

Quote from: MoreBloodWine on January 03, 2008, 09:42:28 PMBest I can figure this is the code that needs to be duplicated / told to grab the Co. GM group...

// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';


So it should look like below BUT the first set of code modified / told to grab the Co. GM group which is NOT a post based group...

// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';

// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';

Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


MoreBloodWine

Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Rumbaar

This mod has the additional membergroups display in profile
Display Additional Membergroups on Profile
I'm not sure of the code to display all the membergroup, but I assume it should be able to be adapted to work in the Display.template.php file as well.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

MoreBloodWine

#12
Quote from: Rumbaar on January 08, 2008, 05:01:22 PM
This mod has the additional membergroups display in profile
Display Additional Membergroups on Profile
I'm not sure of the code to display all the membergroup, but I assume it should be able to be adapted to work in the Display.template.php file as well.
Well, I already loked at that and I'm after the post thing only AS descibed with the secondary group showing above the primary in this case secondary being Co. GM and the primary being Administrator. I posted above what should and will work I'd assume so long as the one code can be told to grab Co. GM and not administrator.

Edit : The simplest most easiest way I see this being achieved is changing the following code / telling it to grab the Co. GM / secondary group and not the administrator / primary group... I know it can be done I just dont have the needed coding skills to do it.

// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Rumbaar

Well I didn't mean to actually use it, but maybe take the code used to get multiple membergroups to display and incorporate that code into your Display.template.php file.

I don't have time now, but I'll try to look at the mod code when I'm home and see if I can work something out.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

MoreBloodWine

Quote from: Rumbaar on January 08, 2008, 05:31:47 PM
Well I didn't mean to actually use it, but maybe take the code used to get multiple membergroups to display and incorporate that code into your Display.template.php file.

I don't have time now, but I'll try to look at the mod code when I'm home and see if I can work something out.
I suppose I could try to pick at it but I'd really rather someone with a more definitive answer come by so I dont have to screw anything up and worry about trying to fix it, and yes I also do backup but still. I know the below code can be modified and told to grab a different group other than the primary group (admin in my case) I just dont know what to change let alone how to change it, this goes beyond my verrrrry limited coding skills.

// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


MoreBloodWine

I cant make heads or tails of that mod as to what I could use but I still think what I posted in my lat post will work if the code can be told to grab the Co. GM group instead of the primary admin group. So with that said (points to his post above this one...)
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Rumbaar

I've moved this to SMF Coding.

With that mod installed I tried ', $message['member']['additionalGroups2'][1] ,' to try and extract the second entry in the array for the Display.template.php.  But for some reason the array isn't populated when in the Display.template.php.  But the code is in Loads.php so it should be accessible.

Hopefully someone from the Customize team will have more of an answer.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

MoreBloodWine

Quote from: Rumbaar on January 11, 2008, 06:53:52 PM
I've moved this to SMF Coding.

With that mod installed I tried ', $message['member']['additionalGroups2'][1] ,' to try and extract the second entry in the array for the Display.template.php.  But for some reason the array isn't populated when in the Display.template.php.  But the code is in Loads.php so it should be accessible.

Hopefully someone from the Customize team will have more of an answer.
Well, yes hopefully someone with a more difinitive answer will come by. As for that mod I dont want / need it installed because I dont want the additional groups shown on profile just in / on the post page. But ya that code I took from the Display.template.php should work just fine if it can be modified / told to grab the Co. GM group which is the secondary group I placed myself in on my forum.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Bulakbol

Install Display Additional Membergroups on Profile. Then in Sources/Load.php, look for

if ($set == 'normal')
{
$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.signature, mem.personalText, mem.location, mem.gender, mem.avatar, mem.ID_MEMBER, mem.memberName,


and add mem.additionalGroups, at the end after mem.memberName,

In default/Display.template.php, find

', $message['member']['group'], '<br />';

and below it, add

if(!empty($message['member']['additionalGroups2']))
foreach ($message['member']['additionalGroups2'] as $additional)
echo $additional. '<br />';


Don't forget to install the "Display Additional Membergroups on Profile" first.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Rumbaar

Ah, that is where I was failing.  Thank you JohnyB

Also if you only want the first of the secondary group, instead of all you can use ' , $message['member']['additionalGroups2'][0], '
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

MoreBloodWine

Ok, once again I DO NOT want to use this mod  because I DO NOT want the additional groups shown on the profile page just the post page, I've been trying to explain that. If someone who knows enough coding can come by and help make work what I've been suggesting then all will be fine so once again... with the proper modifications to the following code I know it WILL work but I lack the skills to modify said code, so with that said how does the below code need to be modified / told to grab the secondary group in this case Co. GM

// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';


If you look at the pic below you will see I've duplicated the above code in my Display.template.php file so it shows Administrator twice on the post page. Well, with the above code changed to grab the Co. GM group the pic would then show Co. GM above Administrator. Now if that isnt clear enough I dont know what is.

Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Rumbaar

Just delete that display code form the Profile.template.php that the mod installs.  It will not display in the profile area then, and you'll be able to use the source code to your needs.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

MoreBloodWine

#22
Quote from: Rumbaar on January 12, 2008, 09:29:44 AM
Just delete that display code form the Profile.template.php that the mod installs.  It will not display in the profile area then, and you'll be able to use the source code to your needs.
Ok, once again I still DO NOT want to use this mod... I have my reasons, and while I appreciate the help for trying to push the mod I wont use it. I know what I suggested / have been suggesting can and will work. If the above code I posted can be told to grab the main primary group then it can certianly be modified / told to grab the secondary group in my case Co. GM , So everyone pleaee stop trying to push the mod on me. I realise this is a free / volunteer service so when someone has the time to come by and help me with what I'm after then great, no real rush so long as what I'm after gets done.
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Rumbaar

Well if the simple install and coding above will meet the needs, I can't understand why.  But that's your choice.

So if someone posts the code here to extract the same db query as the mod does for the source file (which a modification or new code to generate the pull of the secondary membergroups would require) and it's the same as the mod you wouldn't still use it?

You might want to try the Help Wanted section to try and find a coder to do custom work for you, best of luck.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

MoreBloodWine

Quote from: Rumbaar on January 12, 2008, 09:41:56 AM
Well if the simple install and coding above will meet the needs, I can't understand why.  But that's your choice.

So if someone posts the code here to extract the same db query as the mod does for the source file (which a modification or new code to generate the pull of the secondary membergroups would require) and it's the same as the mod you wouldn't still use it?

You might want to try the Help Wanted section to try and find a coder to do custom work for you, best of luck.
Once again I appreciate all the help thus far, but obviously what I want and what I get are most likely going to be two different things but like I've been trying to say... if the below code can be told to grab the primary group which is Administrator then it can certainly be told to grab the additional group in my case Co. GM

// Show the member's primary group (like 'Administrator') if they have one.
if (isset($message['member']['group']) && $message['member']['group'] != '')
echo '
', $message['member']['group'], '<br />';


So with the proper modification to the above code I would get what I want which is shown in the pic below except one of the Adminstrator tags would now show Co. GM

Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Rumbaar

That code makes reference to code found in Load.php. Which in it's current configuration only extracts the Primary Membergroup.  You can't simply alter that code in the Display.template.php file to extract the secondary membergroup or any other membergroup, as the underlying code behind it isn't code that way.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

MoreBloodWine

Quote from: Rumbaar on January 12, 2008, 10:02:40 AM
That code makes reference to code found in Load.php. Which in it's current configuration only extracts the Primary Membergroup.  You can't simply alter that code in the Display.template.php file to extract the secondary membergroup or any other membergroup, as the underlying code behind it isn't code that way.
After reading that I figure wtf may as well give what you and the other guy posted a shot... so with that said heres end product... Thx.

http://www.border-patrol.net/index.php?topic=6.msg11#new
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Bulakbol

Looking good. Did you use this ' , $message['member']['additionalGroups2'][0], ' to get the group name?
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

MoreBloodWine

Quote from: JohnyB on January 12, 2008, 05:49:48 PM
Looking good. Did you use this ' , $message['member']['additionalGroups2'][0], ' to get the group name?
I did what was suggested minus your suggestion to only get one group to show... I didnt need that because I only assigned myself / needed myself in one additional group... now had I needed myself in more than one additional group I woulda done what you suggested if that made any sense lol
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Bulakbol

Understood. The most important is you have it the way you want it displayed.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

Rumbaar

Well that looks exactly how you wanted it?  Also JohnyB had the code to extract all membergroups I was the one who pointed out the single membergroup option.

Can I ask why you were initially so set against using the mod and code modifications?
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

MoreBloodWine

Quote from: Rumbaar on January 12, 2008, 06:50:23 PM
Can I ask why you were initially so set against using the mod and code modifications?
Less edits the better...
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


eline

if(!empty($message['member']['additionalGroups2']))
foreach ($message['member']['additionalGroups2'] as $additional)
echo $additional. '<br />';


JohnyB, what should I do to us this for display star images based on additional groups?
I dont know how jet this arrays works ...

Bulakbol

Hi eline. Forget those codes. I will make a mod for you if you will tell me what custom theme you are using. If you are using default core theme, I can attach the zipped file now.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

barrage time

hxxp:www.rune-live.com [nonactive]
www.rune-live.com, sign up today.

eline


Bulakbol

Quote from: eline on February 24, 2008, 05:52:45 AM
Quote from: JohnyB on February 23, 2008, 08:55:46 PM
I can attach the zipped file now.

Do it :) and tx -> karma point ++

Hi eline. Sorry, there's no option to attach file here. PM me your email address and I'll send you the mod. I'll probably submit it after. Thanks for the Karma point.  ;)
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

FragaCampos

Thanks Bulakbol for this explanation.
I worked great on SMF 1.1.11 :)

Quote from: Bulakbol on January 12, 2008, 05:48:46 AM
Install Display Additional Membergroups on Profile. Then in Sources/Load.php, look for

if ($set == 'normal')
{
$select_columns = "
IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
mem.signature, mem.personalText, mem.location, mem.gender, mem.avatar, mem.ID_MEMBER, mem.memberName,


and add mem.additionalGroups, at the end after mem.memberName,

In default/Display.template.php, find

', $message['member']['group'], '<br />';

and below it, add

if(!empty($message['member']['additionalGroups2']))
foreach ($message['member']['additionalGroups2'] as $additional)
echo $additional. '<br />';


Don't forget to install the "Display Additional Membergroups on Profile" first.

Advertisement: