WordPress.org

Ready to get started?Download WordPress

Forums

How do I insert a username into a URL (4 posts)

  1. thierrymartin
    Member
    Posted 1 year ago #

    I am creating an affiliates-only site for an affiliate marketing program, in order to share marketing materials and links not available to them in the regular panel they use to check their stats. I can create each username from my list of affiliates to match their affiliate ID in their account - for example "1489820" - and when they login to my WordPress site I want the links they see to show their own ID in the right place so they can grab their links and use them from the marketing pages I will create.

    A typical link (where the XXXXX needs to be replaced with their username) would be:

    http://www.1shoppingcart.com/app/?af=XXXXXXX&u=http://marketauthority.com/global-trading-dispatch/join/

    so I need the this link to show to username 1489820 as:

    http://www.1shoppingcart.com/app/?af=1489820&u=http://marketauthority.com/global-trading-dispatch/join/

    Can someone point me in the right direction?

  2. Aaron
    Member
    Posted 1 year ago #

    Going to need way more details to even help on this one.

    Where is this link being generated a plugin? Can you paste the php code that outputs it?

    Also do you have the id stored in a variable already? Or is their username the id number?

  3. thierrymartin
    Member
    Posted 1 year ago #

    This a WordPress site only for logged in users that will manually be given their usernames to match their affiliate IDs in the affiliate program they belong to - I have the links to post on the marketing pages which are coded to credit their accounts with commissions - however I would like each user after logging in to see these links with their username (which will be in the format 1489820) instead of the XXXXX in the links posted on the marketing pages. In other words the links will be ready for them to copy and use, instead of them having to replace the XXXXX with their affiliate ID numbers manually.

  4. Aaron
    Member
    Posted 1 year ago #

    <?php global $current_user; ?>
    <?php get_currentuserinfo(); ?>
    <?php echo 'http://www.1shoppingcart.com/app/?af=' . $current_user->user_login . "&u=http://marketauthority.com/global-trading-dispatch/join/"; ?>

    Would output what you need. Where you are going to put it though I don't know.

Topic Closed

This topic has been closed to new replies.

About this Topic