[#6505] unwanted user level in profile view breadcrumbs

7 years 3 months ago - 7 years 3 months ago #291401 by ukphotoguy
I have a problem after a recent update.
I was aware that recent updates broke my custom template so I have delayed them until this weekend when I set myself the task of fixing the issues.
So, I went from CB 2.0.15 to 2.1.2. I solved my template issues and got an almost identical looking site.
You can see CB in action on the main website www.ncadd.org/about-ncadd/our-affiliates
It is a busy site and CB forms the affiliates and a geo search capability, it all has worked well for many years.
Please go to the site and click on any member. Look at the breadcrumbs, you will see that they are as you would expect, work well and also that the url is reasonably SEO friendly and acceptable. Overall this site showcased CB in an unusual but effective way. The affiliates do update their pages and it serves its purpose.
Now go to the test site which I have left open so you can see it. It is running the modified custom template and CB version 2.1.12 test.ncadd.biz/about-ncadd/our-affiliates
Again please select any user and look at the breadcrumbs, now you see I have an extra level, user, and this not only is distracting but if a visitor clicks it they get the warning message which is quite a distraction.
A big difference between the two sites is how the userprofile menu item is configured. Now I do know that the CB documentation clearly tells me to publish the userprofile menu but in the case of the main site running CB 2.0.15 it is not published and that gives me the neat breadcrumbs and behavior I like. If I publish that menu, then I get the same performance as the test site running the new 2.12 build. Yes, you can just say it is operating as it should, but it makes no sense to me that ordinary visitors must see the user level or get that message.
My question is this, can you help me configure something that helps my situation and lets visitors browse members and get back to the full listing without the member’s level? I see that on your demo site there is no breadcrumbs but the same issue seems to occur, if you were to have them enabled there would be this extra menu option that does not make sense if you are not a member logged into the system.
My best option so far is to leave the userprofile menu unpublished even in the new version, then the breadcrumbs defaults to the main menu level, no distracting user level but the URL is complex and not SEO friendly, also a significant issue for my community, either option will break all the published and searched links that have built up over the years. So I really do need a way of getting the same performance or I am stuck on an old version for life!
There is a chance that I solved this issue by some hack all those years ago, but I normally keep good notes and there is nothing. Please see if you can help.
Attachments:

Please Log in to join the conversation.

7 years 3 months ago #291419 by krileon
The SEO in latest CB 2.x builds got stronger, not weaker. The "user" in your URLs is likely the result of a bad menu item. Do not link to internal pages using an external menu item. Always use internal menu items using the menutype provided by the respective component. In the case of CB ensure you've a public and published Joomla menu item to CBs profile page (this is mandatory). If you make it a top level menu item you can end up with URLs like the following.

domain/profiles/username

With profiles being your Joomla menu item alias. See the below post regarding this.

www.joomlapolis.com/blog/kyle/18704-seo-everything

If you want to maintain the same menu structure to profiles, but need to have multiple menu items to the profile then you just use a menu alias menutype. Below is our demosite profile SEO.

demo.cbdemosites.com/profiles/susan

You can not get rid of "profiles" as it's the only means for Joomla to determine the URL goes to CB.


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 to join the conversation.

7 years 3 months ago #291440 by ukphotoguy
Replied by ukphotoguy on topic unwanted user level in profile view breadcrumbs
I have to say that the reply you gave me and the level of respect you assumed for me is one of the main reasons I get a bad feeling whenever I see anything about CB. Surly your humanity would drive you to try and be a bit more helpful and understanding of my problem. perhaps you have so many requests that your main driver is just to get something answered and off your plate.
Your statement that our new code is much better seems unnecessary and presumably designed to be a shield against any minion trying to suggest otherwise, which I was not.
Then to go on and list the sorts of mistakes others may make or you imagine I made is disrespectful. I was careful to ask my question clearly and to say what I was doing. If you had taken the time to actually read and understand my question you would know what I was doing with menu items.
I am sorry to vent but I am really disappointed that your reply was so unhelpful.
As an FYI the current live site does not have /profiles/user, it presumably gets the direction to route from the search menu item and works fine. As I stated, it breaks your mandatory rule to bind the userprofile menu and instead uses the search user menu to route.
Rather than defend your code perhaps the community might benefit from a more open understanding of what people want of the code. In my use case I believe that the menu structure works well and perhaps others would benefit from being able to use breadcrumbs and not suffer the annoying warning whenever a visitor clicks the profiles level.
I can only hope that others in the CB community are more open and helpful.

Please Log in to join the conversation.

7 years 3 months ago #291464 by krileon
I did not read your topic as clearly as I should have and I did skim it because it's extremely hard to read as a singular giant paragraph so I provided general information regarding CB SEO. I apologize for this, but it would be immensely helpful if in the future you broke up paragraphs and appropriately spaced them as seen in this reply. I have to read a lot of topics every day and as you can imagine it's extremely exhausting were large blocks of text basically become a blur.

Regarding your issue a non-logged in user clicking the breadcrumb path to reach their own profile, which they don't have, will always give that warning. CB used to fallback to userlist for its Itemid when there was no profile menu item so in this case that breadcrumb would be to the userlist. That wasn't valid though and causes &view to break in a lot of cases so CB does not do this anymore.

We do not have a means of workaround this as that is being appended by Joomla it self as we'd need to modify the previous breadcrumb path. Best I can suggest is probably CB Auto Actions to redirect users away from profile page when viewing self when not logged in. The below should do this fine.

Global
Triggers: onBeforeUserProfileAccess
Type: Redirect
User: User
Access: All Non-Registered Users
Conditions
1: [var1] Is Equal To 0
Action
URL: index.php?option=com_comprofiler&view=userslist

As Joomla does not provide a means to exclude a mean item from breadcrumbs I'm not sure what more to suggest. Have added a feature ticket to see if we can somehow remove the URL from the profile breadcrumb so it's no longer clickable if the user is not logged in.

forge.joomlapolis.com/issues/6505

The safest option is probably to still have the mandatory profile menu item, but only use it for registered users by setting its Access to Registered.


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 to join the conversation.

7 years 3 months ago #291521 by ukphotoguy
Replied by ukphotoguy on topic unwanted user level in profile view breadcrumbs
Thanks for getting back on the case. I have started to look for options, so some more information.

If I use on old URL it still gets resolved by the new router, sort of expected that after looking at the code and the cases for legacy paths. But I did not expect that Joomla would resolve the breadcrumbs correctly. So if I use legacy url's as they will be out there on the net and with customers bookmarks things still work, this is great. But puzzled why Joomla is able to continue to use it and resolve the correct (well the version I want) breadcrumb.

So as an test. Using the old CB build on the current live ncadd site and new CB build on the test site:

[Case 1] The old builds path for a profile would be: /about-ncadd/our-affiliates/userprofile/1022

and the resulting breadcrumbs would be

Home / About NCADD / Our Affiliates / NCADD, Juneau Affiliate

[Case 2] Same test on the new CB build with the test site, the profile path is: /about-ncadd/our-affiliates/profile/1022-ncadd-juneau-affiliate

and the breadcrumbs are:

Home / About NCADD / Our Affiliates / profile / NCADD, Juneau Affiliate

[Case 3] Using the old build url on the new CB build

path used /about-ncadd/our-affiliates/userprofile/1022

and the breadcrumbs are:

Home / About NCADD / Our Affiliates / NCADD, Juneau Affiliate

Conclusion: At least I am able to know that all my web based history of stored links and bookmarks will continue if I go to the new build but puzzled that the bookmarks remains as I want it and not how the new CB version provides.

I tried to see if you build the pathway using $pathway function, becasue that would set the breadcrumbs but it seems you guys do not set this or do any joomla like functions that might affect its view of the path.

In the past I have written hacks to the pathway to correct for menu issues, so I am attempting to add some code to set the pathway for profile views, just having difficulty understanding how you build a profile page.

This is my baseline cheatsheet for that code:
//this returns the pathway object for manipulating
$pathway = JFactory::getApplication()->getPathway();
//append item on the end of the pathway - first argument for the name, the second (optional) for a link
$pathway->addItem('Designers','index.php?Itemid=115');
//append just a name to the pathway
$pathway->addItem('Hello hello');
so my hope is to include in the profile view code some code to get the pathway then manipulate it to remove the /profile

My other option is less liked, I can add some code into the joomla core to match the provided URL and override the profile path removing /profile. Not a nice way to go.

Or I can just stay on the old build for a while. In any event it will be the weekend before I can pick this up again. If you or any of the staff have suggestions, all appreciated.

Please Log in to join the conversation.

7 years 3 months ago #291523 by ukphotoguy
Replied by ukphotoguy on topic unwanted user level in profile view breadcrumbs
Could not let this slip out of my mind. A dirty fix does work

I guess for anybody who want's to follow me, there is a quick and effective fix that involves modifying part of Joomla but in a way that might be acceptable.

Assuming you name your mandatory CB profile menu "profile" then this is the breadcrumbs item you want to remove, so create a custom mod_breadcrumbs template file to look for the name profile as it builds the path and either delete it or jump over that item in the list.

I copied the file /modules/mod_breadcrumbs/tmpl/default.php into the templates override folder /templates/your template/html/mod_breadcrumbs/default.php

So now I can have my own version of this that will not get overwritten by core Joomla.

A core version of mod_breadcrumbs seemed to work by replacing line 30 of default.php

if ($i == 1 && !empty($list[$i]->link) && !empty($list[$i - 1]->link) && $list[$i]->link == $list[$i - 1]->link)

to become

if (($i != 1 && !empty($list[$i]->link) && !empty($list[$i - 1]->link)) && ($list[$i]->link == $list[$i - 1]->link || $list[$i]->name == "profile"))

in my case I already had a custom default.php so it was different than core. So I added a line into the loop building the breadcrumb path,

if ( $list[$i]->name == "profile"){$i=$i+1;}

But you have the place to make the change and code for matching the name you just need to figure out how to remove it from the list. Of course if you plan on having menu items called profile you might want to choose a different name for the CD mandatory menu.

It works for me and should be easy to manage.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.230 seconds

Facebook Twitter LinkedIn