First, well done with this module. I was able to get up and running quickly. I appreciate what you've put into this module.

On the Affiliate Center (e.g. http://example.com/user/6/affiliate for user #6), all the affiliate links use the username in the URL. For example:

<a href="http://example.com/affiliate/matt"><img src="http://example.com/files/someimage.png" /></a>

However, if the user has strange characters in the username, or even decides to change his username later one, wouldn't this break the validity of the link? I propose a better way is to use the user ID instead of the username in the URL. E.g.,

<a href="http://example.com/affiliate/6"><img src="http://example.com/files/someimage.png" /></a>

I listed this issue as a critical feature because of the issue of username changes invalidating affiliate links. I'm also using Drupal 5.x, so if this is approved, please do implement on the 5.x version (if not both).

Thanks much!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mgenovese’s picture

To make this suggested feature backward compatible with the current version, perhaps either the username or UID could be accepted. I'm just advocating using the UID from now on because I believe it's safer re: username changes and/or strange characters in usernames.

It's also less conspicuous when reading the URL. For example, .../affiliate/matt indicates that it's me to the person who hovers over the link, whereas .../affiliate/6 is less telling about the affiliate's name info.

bojanz’s picture

Yes, I agree. I'll look into adding it while still making the old method work.

Thank you for your thoughts.

mgenovese’s picture

Great! Thank you.

lonehorseend’s picture

Status: Active » Needs review
FileSize
2.96 KB

I took it one step further and actually customized the link to say me/ instead of affiliate/ in this patch. I've already tested the patch so that it picks up straight links.

dorien’s picture

Great idea! Will the old links stay active as well?

lonehorseend’s picture

No, because it relies on a menu callback that specifies "me." I'm not sure if copying the items[] declaration for "me," passing it, and changing the copy so that it says "affiliate" would work. I'm still learning about menu call backs.

dorien’s picture

That's to bad. The affiliates would need to change all of their already posted links then.

Perhaps just 'add' a second redirect url, which can be chosen at the affiliate admin menu? Something like path redirect does?

lonehorseend’s picture

In the patch, I changed this:

    $items[] = array(
      'path' => 'affiliate',
      'callback' => 'uc_affiliate2_click',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK
    );

to this:

    $items[] = array(
      'path' => 'me',
      'callback' => 'uc_affiliate2_click',
      'access' => user_access('access content'),
      'type' => MENU_CALLBACK
    );

What I think you are proposing and what I think I proposed in my previous post was to actually not replace "affiliate" $items[], but keep "affiliate" $items[] and add the "me" $items[]. Having played around with the whole menu_callback thing for something else, I'm pretty sure it would work.

lonehorseend’s picture

FileSize
3.23 KB

Okay, I've created a new version of the patch. It now looks at me/uid, affiliate/uid, me/username, and affiliate/username. The link that is shown in the affiliate's box is me/uid.

jjeff’s picture

I like the idea of a shorter (and slightly more cryptic) URL scheme for affiliate links. AND I *definitely* think the scheme needs to change from username to user id. But the "me" namespace makes me nervous. I'll bet that there's another module out there which uses this menu item. This is too common a word to use for this purpose.

"me" would indicate something personal about the path... like it's a link to my account or something.

I think that a shortened version of "affiliate" might be a better choice -- something like "af" or "afl".

Just my 2¢

bojanz’s picture

Commited the code that makes it use the uid instead of name.

As for the me/ part, I too have a bad feeling about it, I think it should be user configurable. Another thing for the todo list....

lonehorseend’s picture

I just used "me" in a project I was working on. Definitely change it to something else.

3dloco’s picture

Hello,

Just wanted to know if this has been committed to 6.x-2.x-dev and when do you expect to make it available (code that makes use of the uid instead of username for the affiliate links).

Thanks!

KH

bojanz’s picture

Status: Needs review » Fixed

Yes, this code is in CVS. I am integrating patches and new functionality, after which I will begin testing and stabilizing the codebase. I expect to have a rc1 by the end of the week.

Closing this issue.

lonehorseend’s picture

One thing to consider. Me is definitely not a viable option for changing the link to. It would interfere with the 'me' alias module.

bojanz’s picture

"Me" wasn't commited.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

sleepingmonk’s picture

Version: 5.x-2.1 » 6.x-2.5
Priority: Critical » Normal
Status: Closed (fixed) » Needs review
FileSize
2.21 KB

Hope it's ok to re-open this issue rather than starting a new one for the same topic.

I have a client who insists on using the user name in links instead of id. They're migrating to drupal from a different system and already have affiliates with links out there. I've informed them of all the concerns with this and we're implementing protocols to avoid bad characters in user names and name changes in general.

I'm glad the code in 6.x-2.5 is backwards compatible with names in links and I like that the affiliate path was configurable in the $conf array. I've taken it a small step further and included configurable uid vs name in the same fashion. It defaults to uid but can be overridden to name in settings.php

Patch attached is for 6.x-2.5 as I haven't had a chance to look at dev yet. I'd like some feedback if possible and I'd like to see this in future releases so I don't have to hack the module every time I update it.

Or, if there's already a way to override this with the existing module, please let me know.

Thanks for a kickass module!

bojanz’s picture

Status: Needs review » Closed (won't fix)

See the original post in this issue. There's a reason why the username is no longer used in links...

sleepingmonk’s picture

I did read the original post. I understand the issue and though it may not be advisable to use the username, that doesn't mean it shouldn't be an option. The additional code is very minimal and I don't believe my use case is unique.

If you see my post, I indicate that we will be implementing protocols to avoid possible issues with usernames in the link. Specifically, admins will create affiliate accounts, ensuring a valid username and the userprotect module (which we're already using) will keep affiliates from changing their username.

For general use, the default 'affiliates/[uid]' would be sufficient and unquestioned for most users who download this module. But for advanced users, who understand the risks (which can be documented in the readme), why not allow the option to override? It is very useful in cases like mine where a client is coming to me from a different system and already has affiliates with links "in the wild".

This is a make or break issue with this client case and I don't think the consequences of including the override are even remotely terrible. If it's not there, I can't use the module (with this client).

If I hack it, I need to hack it every time, or maintain my own branch privately. Considering the minor effort it would take to include it, it's quite disappointing to have it rejected completely. Can no one else see the validity of this use case? (preserving already active links from another system) That's why the module was made backwards compatible with the previous version, wasn't it?

Thanks for your feedback.

bojanz’s picture

Status: Closed (won't fix) » Needs review

First of all, if you examine the dev version you will already see that the code has changed and that we have a setting, for choosing ?a or affiliate/ link versions.
Since all development is done in dev, all patches need to be against dev.
But why didn't I just mark it as "needs work" then? Because of the reasons stated in this thread and the fact that it goes against my current vision. Just piling options and options is not a good solution.

Through my work on Affiliate-NG (on which Ubercart Affiliate will one day be based), I'm examining the use cases and how they can be more easily done through additional code (custom submodules), but in any case it has no place in the main module, and that is my decision as the maintainer to make.

If a whole bunch of people show up on this thread asking for the feature, I might reconsider, but that's unlikely to happen.

Leaving the issue as "needs review" so that someone can use the patch if found useful.

sleepingmonk’s picture

Thanks for the info. I'll look at dev when I get a chance. Didn't want to use it on a production site which is why I patched 2.5 as this site will go live very soon.

You've certainly got more experience with affiliate systems than I do, so I appreciate your work and your insight. I hope others who prefer using the user name instead of id for affiliate links find my patch useful.

I look forward to future developments.

bojanz’s picture

The -dev is stable, I will roll 2.6 when I escape from Copenhagen.

Cheers.

univate’s picture

One of the issues with this change is that because there previously affiliate links could be based on a username, upgrading will mean you lose links. Not sure if this change is preventing others from upgrading sites using this module?

bojanz’s picture

That change happened two years ago, and code that handles username's was never removed (not sure if it's there in the latest release, but it was definitely there in 2.5) so that links still work.

univate’s picture

Ok, an upgrade I did a few months appears to have broken some affiliate links. I didn't spend much time on it as there wasn't many links and I got around it at the time by just adding path aliases to point to the UID based links.