We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

How to rename "Your Dashboard" with User's Name [Solution available] | Forum

Rick K
Rick K Dec 20 '13
My apologies if this topic is found elsewhere. I can't seem to bring it up in a search.

I've successfully renamed a number of sections/pages, etc. on my site.

However, I'm stuck in renaming "Your Dashboard". I'd like to rename it for each user, i.e.: "Rick's Home Page" since every user lands on the Dashboard when logging into the site.

Can anyone point me in the right direction to make this a site-wide change that once a user is logged in they see "User's" Home Page instead of "Your Dashboard"?
The Forum post is edited by Alia Aug 11 '14
dave Leader
dave Dec 21 '13

The problem is that neigher the menu or the theme master pages have the username variable set at this point (passed by smarty).  


To test this I went in and added the username var to the actual page name input under admin pages and no good, then i went and added the username variable to the  lang key which is {text key='base+dashboard_heading'} which is the name of the page title at the top of that page, and by default it should read Dashboard (for the dashboard page) if you want to find it in language, and again no good.


So i took a look at the theme master pages and username is not yet set for the page, meaning its not assigned by smarty for this process.  So what this means is that you would have to do a code mod to do this. 


It would require assigning the username variable to the template by setting it in smarty template engine for this process (php file) and then passing it to the theme master html pages.


The master pages would also need have a cod mod, as every page header is static in the sense that it displays heading like so


{if $heading}<h1 class="ow_stdmargin {$heading_icon_class}">{$heading}</h1>{/if}


so that means whatever is in the value of heading, so you would have to isolate the dashboard page and change how it displays that heading when it sees it.


Hope that helps..



The Forum post is edited by dave Dec 21 '13
Alia Team
Alia Dec 23 '13
Rick, Dave, just a tip you might consider using to rename the Dashboard's heading.

1. File: ow_system_plugins/base/controllers/component_panel.php
Original Code: $this->setPageHeading(OW::getLanguage()->text('base', 'dashboard_heading'));
Modified code:

 $displayName = BOL_UserService::getInstance()->getDisplayName(OW::getUser()->getId());
$this->setPageHeading(OW::getLanguage()->text('base', 'dashboard_heading', array('username' => $displayName)));

2.Place to edit next: admin panel>>settings>>languages>>edit text key {text key='base+dashboard_heading'}
Original text: My Dashboard
Modified text:{$username}'s Home

Result:


NOTES:

1. This will rename only heading and not the menu title
2. All custom code modifications will be erased if you updated the software.
3. You are doing any custom code modifications at your own risk. So always back up the file you are editing to have original one just in case.

Alia Team
Alia Dec 23 '13
Topic was moved from General Chat.
dave Leader
dave Dec 23 '13

Thanks Aliia :)


Tested an works great. :) 

The Forum post is edited by dave Dec 23 '13
Rick K
Rick K Dec 24 '13
Ok. Thank you both so very much appreciate it. I will try this out and let you know the result.
Rick K
Rick K Dec 24 '13
Ms. Alia,

After backing up the original file, I did the code changes and it worked just great!

Mr. Dave,

I'm not sure who/what/where "smarty" is. Are you referring to the language section? If so, would that be where one would use "{$Username}" in places like page titles, etc.?
dave Leader
dave Dec 24 '13

Rick,


in this case Aliia as smart as she is bypassed that need by grabbing the array value and using the lang file instead of the html file to display the value, thumbs up Aliia. I admit i was thinking inside the box on this one... 


So rick you dont need to worry about smarty in this case.


But to answer your question, smarty is a template engine, it is how Oxwall (and lots of other scrips) pass values from the php files to the html files for user output and to use those vars in a html file.  


Simply put, the php file has a variable, it assigns a variable value to smarty so that it can be referenced in an html file. 


something like this for example:


 $this->assign('value', $value); // which is  ('value to reference in html file', $php variable value);


so now we can do this in the html file

{if $value}
do whatever
{/if}


if we did not use smarty we would have to make all files php files in order to reference php variables.


http://www.smarty.net/

Rick K
Rick K Dec 24 '13
Dave,

Reading docs @ smarty.net now. Thank you.
Rick K
Rick K Dec 24 '13
Are all changes to such parts (like "Newsfeed") which show on the original "Dashboard" changed in ow_system_plugins/base/controllers/component_panel.php first?

And, would any such change follow the same pattern as the one for the {$username}'s Home? I.e.,  $displayName = BOL_UserService::getInstance()->getDisplayName(OW::getUser()->getId());
$this->setPageHeading(OW::getLanguage()->text('base', 'dashboard_heading', array('username' => $displayName))); would basically be the same for whatever it is one wishes to change - Dashboard, Newsfeed, etc. Just find the appropriate line of code for that page?
dave Leader
dave Dec 24 '13

It really depends on what you are doing. The functions in that file usually speak for themselves as far as function name.  But remember there are also other system plugin files which also compliment the process as well as core and other files.  You really cant put it in black and white perspective like that.  This file is just one piece of the puzzle.

Rick K
Rick K Dec 24 '13
I really believe this can be marked as "resolved". The modification worked for what I asked to do.
Wilson
Wilson Jan 15 '14
hey Allia,

Ok I updated to 1.6 and all is well for the most part. But I am have a issue with this mod. I can find {text key='base+dashboard_heading'} anymore in my languages? Can you help?

I added a pic of my admin area when looking for {text key='base+dashboard_heading'}

wilson
The Forum post is edited by Wilson Jan 15 '14
Attachments:
  dash1.jpg (101.91Kb)
Daisy Team
Daisy Jan 17 '14
Wilson, try searching for the dashboard_heading key, you can use the following URL: http://yoursite.com/...eading&in_keys=y
Wilson
Wilson Feb 12 '14

Thanks Daisy…Ok got it working in the “dashboard” page “heading” but what do I need to do to make the users name appear in the menu title? That would be awesome to have working!



Wilson
dave Leader
dave Feb 12 '14
in that lang text box you put {$username}'s Home or dashboard or whatever you want rather than home. 
Wilson
Wilson Feb 12 '14
hey Dave....thanks for the help. Well I have all this now:

 $displayName = BOL_UserService::getInstance()->getDisplayName(OW::getUser()->getId());
$this->setPageHeading(OW::getLanguage()->text('base', 'dashboard_heading', array('username' => $displayName)));

2.Place to edit next: admin panel>>settings>>languages>>edit text key {text key='base+dashboard_heading'}
Original text: My Dashboard
Modified text:{$username}'s Home

and its showing on the "dashboard" page "heading" (see attached photo). But as Aliia said it dose not show the users name in "menu title" (pages). I tried putting the {$username}'s Home tag in the "menu title" page in the admin area but as you can see in my attached photo its not right.

Wilson
Attachments:
  dash-name.jpg (47.03Kb)
dave Leader
dave Feb 12 '14
oh ok yeah i dont know about the title itself, i just did the header of the page, i did not take it to the next level and do menu, sorry.  im not sure about that one.. 


That might be a challenge, from what i remember that menu is built as an content array and im not sure it would be practicle to do all the changes to make that happen. 

The Forum post is edited by dave Feb 12 '14
Wilson
Wilson Feb 12 '14
Hey Dave......

Well I got everything but that showing the users name...as seen in my previous attached pic. even in the 'News Feed" I got it showing. Well let me know if you get this worked out...would be cool....kind of like facebook dose.

Wilson
The Forum post is edited by Wilson Feb 12 '14
Lunatic Explorer
Lunatic Explorer Feb 16 '14
Thanks Aliia, your mod was most helpful. I also found a mod on this website on how to get it working on mobile view http://www.ewtnet.com/...s-name-on-their.html

Thanks for sharing this awesome mod +1
Pages: 1 2 »