Hi, I would like to create a button for my users to add a link to another user.
Let's say they are discussing userX.
I would like a button that they hit and it asks for username then adds a link to "users/userX".
How do I go about doing that?
I tried to piece it together using some dynamic code from the insert image button, but I'm not really sure of what I'm doing with this.

Thanks for your help!

Comments

ufku’s picture

The simplest way is using javascript prompt:

js:
var username = prompt('Enter username', '');
if (username) E.replaceSelection('<a href="/user/'+ username +'">'+ username +'</a>', 'end');

This assumes you have user/username aliases enabled.(with pathauto module)

ufku’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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