Skip to Content Skip to Menu

Add CB field to title

  • userbk
  • userbk
  • OFFLINE
  • Posts: 64
  • Thanks: 1
  • Karma: 1
13 years 2 months ago #174949 by userbk
Add CB field to title was created by userbk
Hey,

I tried looking for an answer and I was confused by prior posts about the suggestions.

For the moment my profiles produce a page title displayed at the top of any browser as "FirstName LastName - MySiteName"

I need to change that into "FirstName LastName | cb_field1 cb_field2 - MySiteName"

What exactly do I do or what line do I add these fields to in your code?

Thnx,
BK

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
13 years 2 months ago #174975 by krileon
Replied by krileon on topic Re: Add CB field to title

What exactly do I do or what line do I add these fields to in your code?

IN: components/com_comprofiler/comprofiler.html.php
ON: Line 439
Code:
$_CB_framework->setPageTitle( cbUnHtmlspecialchars(getNameFormat($user->name,$user->username,$ueConfig['name_format'])));

Please note it does not support substitutions or anything of the sort. You'll need to pull your fields values directly from user object using $user->FIELDNAME.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • userbk
  • userbk
  • OFFLINE
  • Posts: 64
  • Thanks: 1
  • Karma: 1
13 years 2 months ago #175001 by userbk
Replied by userbk on topic Re: Add CB field to title
Hey K,
Thanks for answering.

This is a guessing game for me. I tried to change the code to:
Code:
$_CB_framework->setPageTitle( cbUnHtmlspecialchars(getNameFormat($user->name,$user->username,$user->cb_profiletype,$ueConfig['name_format'])));

But that resulted in the title changing to the username.

I think I don't quite get how to do this. Could you possibly give me an example of adding cb_profiletype after the formatted name?

Thanks!
B

Please Log in or Create an account to join the conversation.

  • userbk
  • userbk
  • OFFLINE
  • Posts: 64
  • Thanks: 1
  • Karma: 1
13 years 2 months ago #175002 by userbk
Replied by userbk on topic Re: Add CB field to title
Also, I wish to add to this that this change has a huge influence on SEO behaviour. I would suggest allowing us to define in backend what fields to pass onto the title. Just a suggestion though.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48536
  • Thanks: 8290
  • Karma: 1445
13 years 2 months ago #175016 by krileon
Replied by krileon on topic Re: Add CB field to title

This is a guessing game for me. I tried to change the code to:

No, it would be as follows.
Code:
$_CB_framework->setPageTitle( cbUnHtmlspecialchars(getNameFormat($user->name,$user->username,$ueConfig['name_format']).' | '.$user->cb_profiletype));

Also, I wish to add to this that this change has a huge influence on SEO behaviour. I would suggest allowing us to define in backend what fields to pass onto the title. Just a suggestion though.

I agree, would be a good addition. I've added the following feature ticket.

forge.joomlapolis.com/issues/2748


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • userbk
  • userbk
  • OFFLINE
  • Posts: 64
  • Thanks: 1
  • Karma: 1
13 years 2 months ago #175020 by userbk
Replied by userbk on topic Re: Add CB field to title
Naaaaice :)
Thanks K!

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum