Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted April 10, 20178 yr trying to figure out the proper way to code a change to a link. So the current code is: <a href='{$member->url()}' data-searchable> What I would like is to add this to the end of the url "/&tab=field_core_pfield_31" But thus far every attempt I made has ignored what was added. Appreciate any help you can offer
April 10, 20178 yr Something like: <a href='{$member->url()->setQueryString( 'tab', 'field_core_pfield_31' )}'> NOT TESTED.
April 15, 20178 yr Author it didn't work for some reason. What I am trying to do is change a link from the main profile page to the page that has the About Me as the active tab. So I want to add to the profile link. When I use this it ignores the added characters and uses the original link. Basically instead of it linking to: site/index.php?/profile/383-derrick-mason-gray/ I want it to link to: site/index.php?/profile/383-derrick-mason-gray/&tab=field_core_pfield_31 using you link it still links to: site/index.php?/profile/383-derrick-mason-gray/ for some reason. This is the exact code I am trying to update: <a href='{$member->url()}' data-searchable> {template="userLink" app="core" group="global" params="$member"} </a>
April 19, 20178 yr Author don't think so - when you look at the link for a profile page when you are on the About Me tab the link is &tab
April 19, 20178 yr @Zephers OK. Must be talking about different part of the site. This is my link for the profile tab .......r.com/profile/1-admin/?tab=field_core_pfield_1 Are you sure you don't have some other queries before the the "tab=" You need to have a ? right after profile/ to start the query. If you have multiple queries you could have ?something=xxx&tab=field_core.... Sorry if I'm pointing out basic URL stuff if I'm not understanding what you are trying to do.
April 20, 20178 yr Author Might be me not explaining well so on here my profile link is this: https://invisionpower.com/profile/531843-zephers/ But if I look at my About me tab my profile link becomes: https://invisionpower.com/profile/531843-zephers/?tab=field_core_pfield_23 So here you see a ?tab. But on my site when I do the same two links my profile and then my profile using the About Me tab as active the two links are: http://mysite.com/index.php?/profile/1-zeph/ then http://mysite.com/index.php?/profile/1-zeph/&tab=field_core_pfield_31
April 20, 20178 yr OK. This is beyond me. I have no idea how you have &tab in the URL you are showing. It has to be ? to work. But there is a ? earlier that makes no sense to me. Maybe has something to do with friendly URL mapping. Not sure at this point. Sorry.
April 21, 20178 yr Author So here is a weird thing. If I change the & to a ? in my link it still works. But if you naturally navigate to the about me page it is the & So I guess in theory if I have the ? it should still work. Which brings me back to how do I change the below code to include the /?tab=field_core_pfield_31 <a href='{$member->url()}' data-searchable> {template="userLink" app="core" group="global" params="$member"} </a>
April 21, 20178 yr So as was posted by Adriano above, this does what you want if you have $member in the template... <a href='{$member->url()->setQueryString( 'tab', 'field_core_pfield_17' )}'>link</a> That generates ...de/index.php?/profile/1-name/&tab=field_core_pfield_17 on my site which works.
April 22, 20178 yr Author so it doesn't work but I think its because I am putting it into the search template so the coded string is overriding. I think I need to edit the userlink template to make this happen but this one is beyond me: {{if $member->member_id AND \IPS\Member::loggedIn()->canAccessModule( \IPS\Application\Module::get( 'core', 'members' ) ) }}<a href='{{if $warningRef}}{$member->url()->setQueryString( 'wr', $warningRef )}{{else}}{$member->url()}{{endif}}' data-ipsHover data-ipsHover-target='{$member->url()->setQueryString( array( 'do' => 'hovercard', 'wr' => $warningRef, 'referrer' => urlencode( \IPS\Request::i()->url() ) ) )}' title="{lang="view_user_profile" sprintf="$member->name"}" class="ipsType_break">{{if $groupFormatting && $member->group['prefix']}}{$member->group['prefix']|raw}{{endif}}{$member->name}{{if $groupFormatting && $member->group['suffix']}}{$member->group['suffix']|raw}{{endif}}</a>{{else}}{{if $groupFormatting && $member->group['prefix']}}{$member->group['prefix']|raw}{{endif}}{$member->name}{{if $groupFormatting && $member->group['suffix']}}{$member->group['suffix']|raw}{{endif}}{{endif}}
Archived
This topic is now archived and is closed to further replies.