Apr 15 2011

Multi-User YOURLS Plugin.


NOTA: Plugin desenvolvido com a versão do SVN. Incompatibilidades com versão 1.5

Um plugin para YOURLS que habilita a possibilidade de multi usuários.

Como funciona:
Habilitando este plugin serão criadas duas novas tabelas no seu banco de dados. Uma para registro de usuários. Outra para manter registro de qual url pertence a qual usuário. O plugin permite que as estátisticas sejam publicas ou privadas (ao dono do dominio e administrador do site). O usuário, sendo dono, pode remover, ou atualizar links (não recomendado, pois urls já divulgadas não serão mais válidas.)

Como instalar:
- Copiar os arquivos do plugin para a pasta /user/plugins/multi-user/
- Acessar area de administração e habilitar o plugin.
- Para acessar página de usuários acessar seusite.com/user/plugins/multi-user (criar link na pagina inicial é recomendado)

Configurações:
Se quizer alterar alguma configuração default, altere seu arquivo de configurações
YOURLS_MULTIUSER_PROTECTED - TRUE/FALSE - Estatisticas são privadas ao administrador e donos da URL encurtada.
YOURLS_DB_TABLE_URL_TO_USER - Tabela que vai armazenar URL para cada USUARIO
YOURLS_DB_TABLE_USERS - Tabela que vai armazenar os USUARIOS
YOURLS_MULTIUSER_CAPTCHA - Habilita CAPTCHA para se registrar.
YOURLS_MULTIUSER_CAPTCHA_PUBLIC_KEY - Public API Key para o Recaptcha, pegue o seu: https://www.google.com/recaptcha/admin/create
YOURLS_MULTIUSER_CAPTCHA_PRIVATE_KEY - Private API Key para Recaptcha.
YOURLS_MULTIUSER_CAPTCHA_THEME - tema ReCAPTCHA.
YOURLS_MULTIUSER_ANONYMOUS - True se usuarios Anonimos podem encurtar URL, false se somente usuarios registrados e logados.

Ajuda: http://forum.matbra.com/

Changelog 1.7 beta:
- Bugs arrumados.

Download:
Multi -user YOURLS Plugin - Versão 1.7 (beta)

Versões anteriores:
Multi-user YOURLs Plugin - Versão 1.6 (beta)
Multi-User YOURLS Plugin - Versão 1.5 (beta)
Multi-User YOURLS Plugin - Versão 1.3 (beta)
Multi-User YOURLS Plugin - Versão 1.0 (beta)

Comentários do Facebook:

118 Comments

  • By Eric, December 24, 2011 @ 6:54 am

    Have another problem that I can't seem to get worked out. Another user posted with same problem too. When you click the pencil to edit the original link it will not let you save. I'm cusious if this is connected to the other problem that is happening. If 2 users try to create a short link with same web address or url you get error. This happens with a special keyword or with no keyword. Please help me get fixed. I'm willing to donate but tight on cash at the moment.

  • By Eric, December 24, 2011 @ 7:17 am

    Just a quick follow up. If logged in as admin everything is working fine. It will save the edit and only give error for duplicate keywords. The bug apprears to just be in the multi user. It is probably a simple fix, I'm just missing it. Thank you for the help.

  • By Eric Binkley, December 28, 2011 @ 8:11 pm

    The error this "url" is already in database isn't an error at all. It is a YOURLS Config.php setting.
    Changing This From True To False Fixed the duplicate url issue. define( 'YOURLS_UNIQUE_URLS', false );

  • By Eric Binkley, December 28, 2011 @ 8:12 pm

    Still No Luck On The Editing The Original Url With The Pencil Icon. You Can Change original URL but can't save it. I'll figure it out one day and let you know what I find.

  • By Matheus (X-warrior) Bratfisch, December 30, 2011 @ 3:34 pm

    Eric,
    I`m on vacations right now, but give me some time, I will check this problem and solve it asap. Probably on mid Jan.

    Sorry about this problem,
    Matheus

  • By Matheus (X-warrior) Bratfisch, December 30, 2011 @ 3:41 pm

    Eric,

    Strange, are you using what YOURLS version? And what plugin version? Just looked to my test system, and tried to edit a link on pencil w/o admin. and it worked. I`m using the multi-user plugin default config, and u?

  • By Eric, January 2, 2012 @ 3:39 am

    Matheus,
    Thanks a bunch for the plugin. You are amazing man. I'm pretty sure I downloaded yourls 1.5 but then I added .svn file. I'm completely green to all of this and just learning stuff. I'm using default config with multi user too. Except I added define( ‘YOURLS_UNIQUE_URLS’, false ); to allow each user to create the same url more than once. The save feature wasn't working prior. I was thinking about maybe doing a clean install again with maybe different versions and see what happens. If you download from like http://code.google.com/p/yourls/downloads/list it is different than here http://yourls.googlecode.com/svn/trunk/ I thing I used something called tortoise to get the svn file and then uploaded it. Everything works great except pencil and saving the changed url. I'm gonna try to work on it tomorrow some and see if I can figure out the difference between admin and multi user. Hope you have a great vacation. Thanks for checkin on it when you get a chance. I run the new shortner on http://www.rqc.me for memebers of my website to use for tracking their qr codes and links in ads etc.

  • By Eric, January 2, 2012 @ 3:52 am

    I forgot multi user version. The latest one is what I'm using 1.6 beta version.

  • By Matheus (X-warrior) Bratfisch, January 2, 2012 @ 3:17 pm

    Eric,

    Thanks for the information. I'm checking, I don't know why, but when I checked the ajax request, on my system, I receive an answer, on yours I receive "data is null". I still don't understand why. I'm thinking can you change your config password, and other personal information, zip all your YOURLS files and send to me? I will try to make a diff compare to discover what is going on.

  • By moontan, January 4, 2012 @ 4:49 pm

    Hey great plugin. I just tested it but came across some bugs that I'd like to notify you of: When saving shortcuts via an external client (e.g. I used Urly for Android) they are stored in the administrator's database but not in the user's database. In fact shortcuts are created and saved in the database with ANY RANDOM TOKEN/API-KEY! I am not sure if that's actually a problem with the core or your plugin. Can you confirm my observation and if yes: Can it be fixed?

  • By moontan, January 5, 2012 @ 6:28 am

    Me again… I also get this message when refreshing the screen. Maybe the info helps:
    Fatal error: Call to undefined function yourls_string2htmlid() in /path/to/yourls/user/plugins/multi-user/mufunctions.php on line 174

  • By Mohamed, January 12, 2012 @ 7:02 am

    Hello Support,

    I have downloaded the Multi-user plugin for Yourls and installed. It is working fine. I am using yourls v1.5 ( you have mentioned multi-user incompatible with yourls v1.5).
    Please let me know when you have next stable release.
    awaiting for the response.

  • By ERIC, January 17, 2012 @ 8:46 pm

    Thanks, I'll get the files sent over this week I hope.

  • By Yasirli, January 21, 2012 @ 3:31 pm

    how about a link to "Forgot Your Password" ? lot of old people in this word 🙂 , may be you can create it also

  • By Matheus (X-warrior) Bratfisch, January 27, 2012 @ 10:36 pm

    Mohamed,

    This it isn't a support. It is me, the programmer. lol. I don't guarantee it is working with 1.5 but if you say. I'm waiting to YOURLs to release the next version to release multi-user stable release.

  • By Matheus (X-warrior) Bratfisch, January 27, 2012 @ 10:37 pm

    Yasirli,

    I need to write down the idea! Thanks!

  • By KeyJey, February 3, 2012 @ 2:44 pm

    Helo Matheus, you say in one reply here:

    Hello VBk,

    You need to comment this line:
    //yourls_maybe_require_auth();

    But I don't know what is the config file and the path of it so make this configs, can you help me please?

    Thanks.

  • By Eric, February 11, 2012 @ 5:01 am

    Matheus,

    Maybe the smartest person I know. Thanks for your multi user plugin. Thanks for supporting your products too. You fixed the edit url by user and I seriously can not thank you enough. Wishing you and your family the best in 2012. Hope we can work together on something big in the future. You are a genius.

    Thank you,
    Eric

  • By Matheus (X-warrior) Bratfisch, February 11, 2012 @ 5:14 am

    Eric,
    Really thanks for your report and for all time that you spent helping me. I wish to you and your family the best 2012 too!
    Keep in touch,
    Matheus

  • By Dan, March 21, 2012 @ 1:56 pm

    will this be updated for 1.5?

  • By Matheus (X-warrior) Bratfisch, March 21, 2012 @ 2:03 pm

    Hello Dan,

    Probably not. I don't intend to fix this plugin to work with older versions, but with the new ones I have plans. Sorry.

    Best Regards,
    Matheus

  • By CrakTrealry, April 22, 2012 @ 12:02 pm

    How do I put conditioner in my hair before I swim and still keep my swim cap on?I had an asthma attack at swim practice and I'm afraid to go back. Should I go or wait until I start meds?

  • By Paul, April 25, 2012 @ 5:55 am

    Hi Matheus, your script is really good! Thanks taking the time and share your work.

    One question, i got a custom cms with the users table and i would like to show stats based on user/short url.

    How can i achieve this withh your plugin?

  • By Anthony, May 8, 2012 @ 3:54 pm

    Excellent plugin, thank you.

    Do you know how to modify the htaccess file to allow a nicer URL than '/user/plugins/multi-user/' please?

    I would like to use http://yi.tl/u/ for my user admin area instead of http://yi.tl/user/plugins/multi-user.

    However, no matter what I try, I can't get the htaccess file to cooperate. Any help would be appreciated, thank you.

  • By Matheus (X-warrior) Bratfisch, May 9, 2012 @ 10:03 am

    Hello Anthony,
    Have you tried to create a symbolic link to /u/ to /user/plugins/multiuser-user?

    If no try to create one, and you will need to add
    "!-l" on your RewriteCond to make sure that you don't redirect /u/. I think it should work.

    Best Regards

  • By Anthony, May 10, 2012 @ 7:16 am

    Great suggestion, thank you. For anyone else wanting to implement this:

    1. Open .htaccess and add the following with the other conditions:
    RewriteCond %{REQUEST_FILENAME} !-l

    2. Open up your UNIX shell and run something like this:

    ln -s /usr/www/users/MYACCOUNT/MYDOMAIN/user/plugins/multi-user /usr/www/users/MYACCOUNT/MYDOMAIN/u

    Don't use trailing slashes for the folder names.

  • By Hentai, May 18, 2012 @ 6:04 am

    @Anthony Thanks, that worked wonderfully.

    @Matheus I am running into the following error:
    Fatal error: Call to undefined function yourls_string2htmlid() in /home/utau/public_html/go/user/plugins/multi-user/mufunctions.php on line 174

    I am using the 1.7 Beta. Also had issues registering on the forum. I guess it didn't like my IP address or something?

  • By Matheus (X-warrior) Bratfisch, May 18, 2012 @ 1:39 pm

    Hey Hentai,

    Strange. I didn't try the 1.7 beta version. I'm waiting for the next stable release to fix everything, it is hard to keep my plugin following the SVN version, because if I get rev XYZ for example and you get XYZ+1 maybe the plugin will not work. Sorry about that.

    Uhm, strange... a few weeks ago I was under a bot attack so now, I put some captache verification, password strong and this kind of stuff, but blockeds ip no. Did you checked the box right below the banner reporting the error?

  • By Kirt Cathey, May 30, 2012 @ 8:44 am

    When I activate multi user, then login as a user (after signing up), none of the URLs are listed. Am I missing something here?

  • By Matheus (X-warrior) Bratfisch, May 30, 2012 @ 11:58 am

    Sign in, Log in, short some url and check the urls. Got it?

  • By Kirt Cathey, May 30, 2012 @ 4:21 pm

    Thank you for the reply.

    Right. Did all that, but when I login to the user page where the URLs are supposed to be listed, nothing appears. Other people are having this problem too. It shows the URL stats for that user, but does not list the short url or any thing.
    SO, if I sign in, log in, short some URL all is fine. BUT, if I try to go back later to see stats, and if I login as user, nothing appears in the URL listing.

  • By Matheus (X-warrior) Bratfisch, May 30, 2012 @ 4:52 pm

    Kirt,

    I remember that I already fixed this problem. I just don't remember how. What YOURLS version are u using? What is your configuration? What multiuser version? What is your php version?
    Can you use http://forum.matbra.com so we can talk?

  • By Wayne, June 8, 2012 @ 2:06 am

    What version of YOURLS will this work with?
    The latest seem to be 1.5 the SVN version you mentioned, it that before or after 1.5

    Thank you

  • By Matheus (X-warrior) Bratfisch, June 12, 2012 @ 12:53 pm

    Wayne,

    It is 1.5+. You can get the snapshot that I used on http://www.matbra.com/?attachment_id=1170

    Best Regards

  • By pgrytdal, June 19, 2012 @ 9:37 pm

    Hello!

    If someone tries to shorten a URL that another user had already shortened, then tries to delete it, will the URL be deleted? Or no?

    Also, I was wondering... I need a plugin that would allow me to block specific domains from being shortened. I Can you make one like this?

  • By Wayne, June 19, 2012 @ 9:58 pm

    Thank you Matheus

    I figured it and it's working great.

    Great Job

  • By Sundar, August 2, 2012 @ 1:37 pm

    Thanks for your great plugin

    if(!defined('YOURLS_MULTIUSER_CAPTCHA_PUBLIC_KEY')) {
    define('YOURLS_MULTIUSER_CAPTCHA', "mykey");
    }
    is this the way to give the key?

  • By Matheus (X-warrior) Bratfisch, August 2, 2012 @ 1:46 pm

    Sundar,

    This way it will work, but it is not the correct way. The correct way is edit your confi file usually user/config.php and add the line define('YOURLS_MULTIUSER_CAPTCHA', 'your_key');
    Thanks.

  • By Sundar, August 7, 2012 @ 10:22 am

    super and great work man

    it works like nothing.

    thanks for support.

  • By pgrytdal, September 5, 2012 @ 3:15 pm

    Hello!

    I was wondering...

    A.) I had a lot of already shortened URL's on my YOURLS before adding your plugin. Can I associate different URL's to different users?

    B.) Can I make one of my users an admin?

    Thanks!

  • By pgrytdal, September 5, 2012 @ 3:18 pm

    Oh...

    C.) my install is one where there is one unique Short URL for one unique long URL. (Default YOURLS setting. Not like Bit.ly) If one user "deletes" a URL that another user has (tried) to shorten, does that first user delete the URL for everyone, or just him?

  • By Matheus (X-warrior) Bratfisch, September 5, 2012 @ 3:27 pm

    Hello,

    A) If you add plugin with a lot of shortned URLS, you can associate but you will need to this by hand. So if you want all old URLS to be yours it is easy, otherwise, can be hard.

    B) Right now the Website ADMIN and Users are separated, but when you enable the plugin the system will create a Multi-User with the same info as your ADMIN.

    C) ON DELETE we just remove the data that says that some KEYWORD belongs to a SPECIFIC user. So if you have AAA pointing to google.com and I have BBB pointing to google.com and you delete your AAA, multi-user will remove AAA from your account and YOURLS will take care of the rest. YOURLs works with keywords so it will remove AAA and I still have my BBB pointing to google.com.

    PS: Remember to backup your database! We are in BETA and waiting for bugs reports. YOU are the responsible, we do NOT guarantee anything.

    Best Regards and Enjoy!
    Matheus

  • By Simone Freelance, November 2, 2012 @ 9:36 am

    "There are incompatibilities with 1.5 version"

    What incompatibilities you are talking about?

    Thanks
    Simone

  • By Matheus (X-warrior) Bratfisch, November 2, 2012 @ 11:05 am

    I'm not sure, I developed it under a SVN version not to the old 1.5 version, but I received a lot of messages saying that is not working with 1.5 and I'm not going to code it to 1.5, I'm waiting the next release

  • By Steven, December 20, 2012 @ 9:37 am

    When user login in it says your token number is. What is that? How do I remove it?

  • By Matheus (X-warrior) Bratfisch, December 20, 2012 @ 12:01 pm

    If user want to use the YOURLS api as a logged user it could use his token. If you want to remove edit admin.php (from multi-user folder) and find the line "Your token..." and remove it. 😀

  • By Marcel, March 8, 2013 @ 7:45 am

    Hi! your plugin is great! your script is really good! Thanks taking the time and sharing your work.

    As somebody else asked before user integrations, I would really like to auto register YOURLS multi-users from Buddypress members via the YOURLS: WordPress to Twitter plugin, basically writing the YOURLS users table and assigning the same short url to that user from the short URL keyword from which the plugin creates a new link on YOURLS.

    The idea behind it is to show stats based on WordPress user/short url

    How could this be achieved this with your plugin?? all the best!

  • By Matheus (X-warrior) Bratfisch, March 13, 2013 @ 1:44 am

    Hello Marcel,

    It is possible to change it to do what you want, if I understand correctly, you want to create a page that the creator user and short id will be the same, am I right?

    If yes, to do this we need some modifications to the plugin for example, when creating a URL via API calls it creates a new user and associate to it. (I'm not exactly sure if I understand correctly)

    But I don't see the point of doing this, you will create a URL per USER always? So why don't you just create the short URL? The problem is tracking it back to which page created it?

  • By Marcel, March 15, 2013 @ 7:02 am

    Hi Matheus! thanks for your prompt response. Yes, you understand it correctly, the thing is, I want to associate the same WP username with the YOURLS Multi-user name, so each WP user can have his own account in YOURLS. I thought and easy way to do it was via the YOURLS: WP to Twitter plugin, which already creates a short link from the Buddypress nice_name, which re-directs to the WP user Profile page.

  • By Matheus (X-warrior) Bratfisch, March 19, 2013 @ 8:24 pm

    Hey Marcel,

    So you want that all users from WP has an account inside YOURL's and create short links to WP post associate to the WP post author?

    I don't think it is that easy to use that plugin, that plugin will just create a shortned url to the WP user Profile, if that is what you want, you can use the plugin that already do this.

    It is possible to do what you want, but or your WP will need to update YOURL's database (ugly) or we will need to add an API to user creation. That is not available now and I'm not exactly sure if I will do it. (as I told other guys, i don't make money from this plugin, so I can put a lot of my time on it)

    If you need that really bad maybe we can figure something out.

    Have a good one!

Other Links to this Post

RSS feed for comments on this post. TrackBack URI

Leave a comment