"Hey [Member Group] [Username]" feature?

Started by R4C3R, May 24, 2009, 11:48:07 AM

Previous topic - Next topic

R4C3R

You know how when you log in your username it says
"Hey [username], you have 3 new messages"?
I would like to make it:
"Hey [member group] [username], you have 3 new messages".
I don't care about the messages part, but I would like it to look something like..
"Hey Administrator R4C3R".

Please and thank you.



Sorry if I post this in the wrong section.

Marcus Forsberg

Please attach ./Themes/{your_Theme}/index.template.php here.

sAce

u know, this will show " hello regular members xxuser " for ur members

R4C3R

I would change the member groups by the way.

Um, the theme is the default theme. I haven't started looking for another theme just yet.

I don't know where I can find the default theme's index.template.php

Which code do I need to edit?

Marcus Forsberg


R4C3R

I will be changing my skin to "DarkBreak" soon enough, so I attached it's index.template.php.


Bulakbol


I believe this requires additional query to the database for membergroup name.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

[SiNaN]

Sources/Load.php

Code (Find) Select
SELECT mem.*, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType
FROM {$db_prefix}members AS mem


Code (Replace) Select
SELECT mem.*, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType, IFNULL(mg.groupName, '') AS member_group, IFNULL(pg.groupName, '') AS post_group
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS pg ON (pg.ID_GROUP = mem.ID_POST_GROUP)
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = mem.ID_GROUP)


Code (Find) Select
'ip2' => $_SERVER['BAN_CHECK_IP'],

Code (Replace) Select
'ip2' => $_SERVER['BAN_CHECK_IP'],
'group' => !empty($user_settings['member_group']) ? $user_settings['member_group'] : $user_settings['post_group'],


index.template.php (your theme)

Code (Find) Select
if ($context['user']['is_logged'])

Code (Replace) Select
global $user_info;
if ($context['user']['is_logged'])


Code (Find) Select
<li><b>', $txt['hello_member'], ' ', $context['user']['name'],'</b></li>';

Code (Replace) Select
<li><b>', $txt['hello_member'], ' ', $user_info['group'], ' ', $context['user']['name'],'</b></li>';

index.template.php (for SMF Default Theme - Core)

Code (Find) Select
if($context['user']['is_logged'])

Code (Replace) Select
global $user_info;
if($context['user']['is_logged'])


Code (Find) Select
$txt['hello_member_ndt'], ' ', <b>',

Code (Replace) Select
$txt['hello_member_ndt'], ' ', $user_info['group'], ' <b>',
Former SMF Core Developer | My Mods | SimplePortal

R4C3R

I didn't get the Sources/Load.php thing, but I went down below and used the "index.template.php (your theme)"

index.template.php (your theme)


Code: (Find) [Select]
Quoteif ($context['user']['is_logged'])

Code: (Replace) [Select]
Quoteglobal $user_info;
      if ($context['user']['is_logged'])

Code: (Find) [Select]
Quote<li><b>', $txt['hello_member'], ' ', $context['user']['name'],'</b></li>';

Code: (Replace) [Select]
Quote<li><b>', $txt['hello_member'], ' ', $user_info['group'], ' ', $context['user']['name'],'</b></li>';

I searched and replaced the above code and when I uploaded it, nothing changed? :l

[SiNaN]

You need to apply Load.php edits too. It won't work otherwise.
Former SMF Core Developer | My Mods | SimplePortal

Bulakbol

I was thinking about sub-routine (function) instead of JOIN to query the groupname in case he need it in another page. I think JOIN is faster although I can't prove it.
Please do not PM me for support · My Mods and Theme · SMF Coding Guidelines · Modifications Approval Guidelines

R4C3R

I don't have a load.php file? o_0

All I have in my zip folder is:
images (folder)
languages (folder)
BoardIndex.template.php
index.php
index.template.php
MessageIndex.template.php
style.css
theme_info.xml

Where can I find load.php?

[SiNaN]

Former SMF Core Developer | My Mods | SimplePortal

R4C3R


[SiNaN]

The file you attached has the contents of ./Themes/{your_theme}/ directory. Check the Sources directory in your forum root. Your forum wouldn't work without that file.
Former SMF Core Developer | My Mods | SimplePortal

R4C3R

I don't know where the sources directory is.

I'm an admin and not the 'forum admin' who made the forum, btw.

I tried adding my forum url, then "/themes/darkbreak/"
                                                    "/themes/darkbreak/source"
                                                    "/themes/darkbreak/sources"
                                                    "/themes/darkbreak/source/load.php"
                                                    "/themes/darkbreak/sources/load.php"
Nothing comes up, or it just says Page not Found.

How do I access this load.php file, and where do I access it? From the admin menu? Themes & Layout? Theme settings? D;

Sorry if I'm a complete idiot about this.

[SiNaN]

You need FTP access to edit that file. If you don't have it, can you install packages?
Former SMF Core Developer | My Mods | SimplePortal

R4C3R


[SiNaN]

Modification packages.

Admin > Package Manager
Former SMF Core Developer | My Mods | SimplePortal

R4C3R

ok.

What packages should I install and upload ?

Advertisement: