Notifications
Clear all

wpForo 1.x.x [Closed] Shop account target link

17 Posts
3 Users
0 Reactions
1,060 Views
Posts: 10
 SN21
Topic starter
(@sn21)
Active Member
Joined: 4 years ago

Hello all,

Is there a way to change the target link of the “Shop account” button in the user’s profile page?

Thank you!

16 Replies
Tutrix
Posts: 1493
(@tutrix)
Noble Member
Joined: 5 years ago

@sn21

you can use this code

add_action( 'wp_head', function () { ?>
<script>
jQuery(document).ready(function($) {
$(".wpforo-profile-home .wpf-field-type-url a[href^='http']").attr('target','_blank');
});
</script>
<?php } );

either via How to Easily Add Custom Code in WordPress (without Breaking Your Site)

or in the functions.php of your WP theme

replace " _blank " with the target you want

1 Reply
 SN21
(@sn21)
Joined: 4 years ago

Active Member
Posts: 10

@tutrix

Thank you very much!

I will try it and let you know!

Posts: 10
 SN21
Topic starter
(@sn21)
Active Member
Joined: 4 years ago

I used snippets plugin and activated the above code, but it didn't work.

The target link has not changed.

I don't know if I missed anything, but I followed the steps as described.

More specific:

The current link of "Shop account" button in user profile is 'https://mysite.com/my-account/' and I would like to change it to: 'https://mysite.com/myshop/'

 

Thank you again for your time.

Posts: 10
 SN21
Topic starter
(@sn21)
Active Member
Joined: 4 years ago

Hello again, anyone that may suggest a solution?

The button is in "wpf-pp-menu-item".

I have attached an image indicating the button to which I am referring to for better understanding.

 

Thank you.

12 Replies
Tutrix
(@tutrix)
Joined: 5 years ago

Noble Member
Posts: 1493

@sn21

Open the shop link with the browser inspector and search for the css class from the shop url

Example the css class from code above

wpf-field-type-url

https://www.screencast.com/t/UU0ZsvLh

 

add_action( 'wp_head', function () { ?>
<script>
jQuery(document).ready(function($) {
$(".wpforo-profile-wrap .your-shop-url-class a[href^='http']").attr('target','_blank');
});
</script>
<?php } );

and replaced "your-shop-url-class" with the class from the shop link

 SN21
(@sn21)
Joined: 4 years ago

Active Member
Posts: 10

@tutrix

The class id that I got is :
a class="wpf-pp-menu-item" href="https://mysite/my-account/"

So the code will be (correct me if I am wrong):

add_action( 'wp_head', function () { ?>
<script>
jQuery(document).ready(function($) {
$(".wpforo-profile-wrap .wpf-pp-menu-item a[href^='http']").attr('target','_blank');
});
</script>
<?php } );

 

?

Tutrix
(@tutrix)
Joined: 5 years ago

Noble Member
Posts: 1493

@sn21

remove the "a" tag

add_action( 'wp_head', function () { ?>
<script>
jQuery(document).ready(function($) {
$(".wpforo-profile-wrap .wpf-pp-menu-item[href^='http']").attr('target','_blank');
});
</script>
<?php } );
 SN21
(@sn21)
Joined: 4 years ago

Active Member
Posts: 10

@tutrix

I think I am missing something, or I am asking the wrong question.
The link did not change.

I reinspected the element and get this:

a class="wpf-pp-menu-item" href="https://mysite.com/my-account/" target="https://myshop.com/myshop/"

When I press the button it still links to "my-account", and not to "myshop"

Should I change the code 'target' to 'href' or something?

Thank you for your patience.

Tutrix
(@tutrix)
Joined: 5 years ago

Noble Member
Posts: 1493

@sn21

Posted by: @sn21

Is there a way to change the target link of the “Shop account”

you don't want change the target of the link

The target attribute specifies where to open the linked url.
and don't change the link itself

you have to change the link to the shop where you created it 😉

 SN21
(@sn21)
Joined: 4 years ago

Active Member
Posts: 10

@tutrix

Thank you very much Tutrix, but if you mean to change the hyperlink of the page, unfortunately this is not an option me.

I need to change the linked url of the button as you correctly said.

I am sorry for any misunderstanding.

Tutrix
(@tutrix)
Joined: 5 years ago

Noble Member
Posts: 1493

@sn21

where did you create the menu item "shop account"?
there you have to enter the correct link to the shop

do not change anything else, just this only one menu item

 SN21
(@sn21)
Joined: 4 years ago

Active Member
Posts: 10

@tutrix

Actually, I did not create it (i wouldn't know how 😊 ).

It was already there, after installing wPForo plugin. 🙂 

 

Robert
Admin
(@robert)
Joined: 9 years ago

Support Team
Posts: 10591

@sn21,

There is no option to change the shop account UR, it's added automatically when it detects WooCommerce installation, it refers you to WooCommerce profile page. And the question is why do you want to change the URL? If you don't want your users to go to their customer account page then just disable this button by a small CSS code.

 SN21
(@sn21)
Joined: 4 years ago

Active Member
Posts: 10

@robert

Hi Robert and thank you for your reply.

I have a different shop account page for each user role. 

Actually, disabling it would be most helpful!.. 

Could anyone help with the CSS for disable?

Robert
Admin
(@robert)
Joined: 9 years ago

Support Team
Posts: 10591

@sn21

Here are the CSS codes to hide all kind of profile header buttons: https://wpforo.com/community/how-to-and-troubleshooting-2/can-not-access-to-button-message/#post-29642

 SN21
(@sn21)
Joined: 4 years ago

Active Member
Posts: 10

@robert

Thank you for the link. I will check that out!