Jump to content

How to create a dynamic link to the user profile


Recommended Posts

4 minutes ago, opentype said:


It isn’t possible.


I think there is a solution, but I hope there is a better one : 

The link goes to a php page which get the id member and redirect to the member page : this should work, but not very sexy solution

If there is not other solution, I will try to build this one

Link to comment
Share on other sites


  1. Create your menu item - put whatever URL you want in there (maybe make a copy of the one that exists for /profile/id-?? already but remove the id bit? Or create one called myprofile? Your choice entirely)
  2. Publish the menu.
  3. Go to your set, view the page source and search for the new menu item you added.
  4. Note the data-navItem-id value
  5. Go back to the ACP, search for Google Analytics and open up the section for "Enable analytics tracking code"
  6. In the tracking code section put the code below in place, replacing XX with the value you noted in step 4, and then save the change.
  7. Back to the site, refresh and click the menu item you put in place.
	$("a[data-navItem-id='XX']").click(function(e) {
		window.location = 'profile/' + ips.getSetting('memberID') + '-a/';

Note: if you do not have "Rewrite URLs" enabled in the ACP's friendly urls options then add index.php?/ before profile/ in the line for window.location

Link to comment
Share on other sites

I am impressed by the solution
It is working very fine.

I only one question : google analytics will still working ?

Now I have this on the Google Analytics tracking code area on ACP



  $("a[data-navItem-id='52']").click(function(e) {
        window.location = '../profile/' + ips.getSetting('memberID') + '-a/content/?type=classifieds_advert';
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

  ga('create', 'UA-xxxxxxxxx', 'auto');
  ga('send', 'pageview');



Is there another place I could add your code ?

Thank you very much !

Link to comment
Share on other sites

Google analytics will not stop working, unless you break the code.....but test it to make sure it is still working  Any amount of javascript code can go in that section.

You can put the code wherever you want in your themes though too - all up to you. Putting it in the analytics section is just convenient as you don't have to edit a theme there...you could make a plugin, if you wanted, to achieve the same thing.

Link to comment
Share on other sites

  • 1 month later...


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...