Skip to content

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)

134 Comments

  1. Paul Paul

    WOW! Really great plugin!!

    One answer:
    Is it possible for the users to use api?

    thank you!

  2. Paul Paul

    The statistic page for a short link is only available if I logged in. If I call the statistics when I'm logged off I get the error:

    Fatal error: Call to undefined function yourls_get_request() in /var/www/.../user/plugins/multi-user/infos.php on line 12

    What can I do?

  3. Hello Paul,
    As a safety question I did this:
    - admin can use all API
    - expand and shorturl can be used by anyone
    if you are logged or use your hashcode (generated when you signup) the shortened link will go to your account.
    - stats, db-stats and url-stats can be accessed if your YOURLS_MULTUSER_PROTECTED is false
    - if YOURLS_MULTUSER_PROTECTED is true, only the owner can get the shortened status
    Did you get it?

  4. Your second problem, I tried to reproduce but I couldn't.
    For example, my system have YOURLS_MULTI_USER as TRUE.
    If I'm logged out and try to access some stats as myweb.com/f+ I can't see it, and go to main page, if I'm logged in I can see it.

    Can you show me your webpage? If you want to contact me by e-mail at matheusbrat [AT] gmail [DOT] com and we can try to figure out this problem.

  5. VBk VBk

    Matheus ,

    I was looking for the 'Registration " feature and your plugin is a great and more advanced

    I found an issue with pages :http://mydomain/com/user/plugins/ and http://mydomain/com/user/ . These is showing all the links and looks like something un-necessary . Is the only solution is edit and customize the core files to change the look of the pages are hide them?

    >- Comment (//) the second line of yourls-api.php file.

    AM I need to Comment this line : //define('YOURLS_API', true); ...?

    I am unsure about the advanced setup you explained here : If you want something different than default setup, achange your config file. Could you please write a guide about them?

    Thanks !

  6. VBk VBk

    Matheus ,

    Another thing...site.com/yourls-api.php is not accessible by anonymous users or the registered users.

    I use my Yourls installation with third party services like Tweetdeck and my own wordPress installation (using WordPress plugin). Does the Yourls Site works with those third party services if the API is inaccessible?

    Thank you!

  7. Eyal Eyal

    Thanks for the plugin,
    There is one major issue I have spotted.. different users will share the same statistics in case they shorten the same URL..
    In addition.. the lack of API support is quite problematic..

  8. Eyal Eyal

    last comment was reffered to the YOURLS_UNIQUE_URLS = true

  9. Hello VBk,

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

    If you want a advanced config you have to edit /user/config.php
    But I think you want the default installation config.

    The api is not accessible by anonymous user. But, if you're a registered user you can access it. When a user is registered the system generate a random TOKEN to use in the api. To access it, you have to do your request to api using yourls-api.php?XYZ&token=YOUR_TOKEN

    You must replace XYZ with the parameters of your api request parameters.

    Like I said, you can access the api as a registered user using your token, but most of the Third part services don't have an option to add the TOKEN as a parameters. So you will need to hack your tweetdeck, or wordpress to use it.

    For example, I'm using wp to twitter in my WordPress account, to enable it to use my token I edited wp-to-twitter.php, and edit the remote request parameters.

    In this row, I add the token feature, so the requests from my wp-to-twitter goes to my account.

    $api_url = sprintf( get_option('yourlsurl') . '?username=%s&password=%s&url=%s&format=json&action=shorturl&keyword=%s&token=a4da7a419aabf00753862614da7a419aabfd333760469',$yourlslogin, $yourlsapi, $thispostlink, $keyword_format );

    Best Regards,
    Matheus

  10. Eyal,

    Yes I guess so. The users will share it. I didn't think a way that is "correct" when this happens, so this is the normal behaviour, if I'm not wrong there is some kind of option of yourls that you can define if multiple shortened urls to the same URL will be the same stats or not.

    I'm not sure about this right now, I will try to think more about it in the next days.

    Thanks for your comment,
    Matheus

  11. VBK VBK

    Matheus ,

    I have a feature request and hope you would implement it
    -"About Token key display in Admin panel"

    A user can view the token only during signup . He can't use the key if he forgot to retrieve it during signup. So it is convenient to users if they have change to note it down from Admin panel.

    Thank you !

  12. VBK VBK

    Regarding my previous question...I have followup questions and posted in this wiki-page for easy understanding.

    This is the URL http://doowikis.com/m/NDkZ4T1xVx and feel free to edit the page with your message

    Please let me know if you want me to post the question directly in this blog. But I feel it is convenient there

    Thanks !

  13. I agree with your previus question, it will be nice to display the user token.

    Actually I'm still thinking about the future of this plugin. Because, if you see in the roadmap of YOURLs. Ozh intend to develop all this features on the core of the YOURLS so I'm not sure if it's a good stuff to keep the dev of this plugin. Because it will become obsolete.

    But I really appreciate your feedbacks. Really thanks,
    Matheus

  14. VBK VBK

    Matheus ,

    >Actually I’m still thinking about the future of this plugin.

    You are right ! I am closely observing the Yourls updates for several months. I think Ozh will take much time to realease the version with Multiuser support. According to the Road map the next version will be 1.6 and I think it will take at-least 1 month

    After that the next version may be released in 4-6 months(He mentioned Version Undecided. So that may take several months). Until then the Yourls Users can use your plugin and you can influence Yourls users. Who knows ...? May be ozh would ask you to join him for implementing the feature in Core.

    Also you may get more Ideas other than the Multi-user support. So if you have a perfect forum and run a separate site for Your plugins, you will definitely get a good response and you need not worry about a single plugin's future. You may create other plugins like WordPress and yourls Integration(Full integration), Drupals + Yourls Integration and more.

    Sorry ...if I crossed limits to suggest these. I just wanted to encourage a good developer who made a " Multi-user " feature possible

    I can help you to run the forum. I can create a forum on my own server to honor you

    Thanks !

  15. VBK VBK

    Sorry for the another post. I found a problem

    Bug report :

    The stats of ShortURLs and other details are disappearing on browser refresh . I mean to say that the user-Admin pages are not showing up details as earlier

    Also replied to wiki's question -http://doowikis.com/m/NDkZ4T1xVx

    Thanks !

  16. VBK,

    You motivated me to develop a little bit more and create the forum. You can access it on http://forum.matbra.com

    I will use the forum to other PLUGINS, PROGRAMS, STUFFS that I create.

    And I just released a new version with some minor fixes.

    About your last "BUG", I didn't get it and I can't reproduce it here. Please explain how to reproduce the bug.

    Best Regards,
    Matheus

  17. VBK VBK

    Matheus ,

    I have replied to your last comment and submitted some screenshots for that

    I think the response was caught under Moderation. Could you please check that?

  18. Hello VBK,

    I understand what is happening, but I can't reproduce it. I created a shortened link, logged in my account... than create other, wait a few time and refreshed... and both are there. I also checked on admin dashboard and all the links were there.

    I can't figure out why this is happening. Can you give me access to your server as a user so I can try it by myself?

    Best Regards,
    Matheus

    PS: Let's try to use the forum.

  19. yes, similiar to VBK when i refresh i lost the urls!

  20. Pks ichn,

    Can you please give me access as a user to your service? I can`t get this problem here. Maybe it is a config problem.

    Best Regards,
    Matheus

  21. Pks Ichn,

    It seems to be a incompatibility problem with YOURLS 1.5. Try using the SVN Version please.

    Best Regards,
    Matheus

  22. MadMakz MadMakz

    Hey there.
    I get an "Input error: k: Format of site key was invalid" error on signup page.

    define('YOURLS_MULTIUSER_CAPTCHA', false);

    And thus nobody can register while it fails to verify the non existant captcha:

    "Captch is incorrect."

    Using latest Yourls trunk r691 (1.5.1-gamma).

  23. Hello MadMakz,

    There is a bug right now. I'm still checking the config combinations to verify if everything is working. Probably Monday I will release a new version. For now, if you want to fix it, open mufunctions.php look for captchaEnabled and replace this line
    -
    if(defined('YOURLS_MULTIUSER_CAPTCHA') && (YOURLS_MULTIUSER_CAPTCHA_PRIVATE_KEY != 1) && (YOURLS_MULTIUSER_CAPTCHA_THEME != 1))
    -
    FOR THIS ONE
    -
    if(defined('YOURLS_MULTIUSER_CAPTCHA') && (YOURLS_MULTIUSER_CAPTCHA == true))
    -

  24. MadMakz MadMakz

    Working perfect now. Thanks! 🙂

  25. DirkE DirkE

    Hello Matheus,

    I am testing your multi-user plugin. It looks like that wat I want, but I do have some touble with it:
    After adding the second url or after edding the first I receive only the counter :
    "Display 1 to 3 of 3 URLs , counting 0 click ."
    And an error: "Fatal error: Call to undefined function yourls_string2htmlid() in /srv/www/htdocs/xxxx/html/yyyy/rd/user/plugins/multi-user/mufunctions.php on line 174".
    Can you help me to solve it?

  26. DirkE DirkE

    Hello Matheus,
    I think that Ih have found out something about my problem: Your are using the functions-formatting.php and in new installations it is not in the package. Also I think, that the sql handling of the multi-user plugin does not work correctky: To many open queries to the database?
    It would be great, if you can have a look on your source, because Im still learning php ...

  27. Hello Dirke,

    I can take a look on the source code. What version of YOURLS are you using? You MUST have the SVN version the latest stable release it is not compatible with the plugin. What is your shortener address?

  28. DirkE DirkE

    Hello Matheus,
    thank you ... that was the answer! I just did use the false release! After installing the SVN-Version everything was fine! Thank you for your plugin!!!
    One feature I am searching for is how to include your frontend into wordpress. My installation is running in a subdirectory from wordpress. I have already the .htaccess modified to redirect to a special yourls_loader2.php to redirect everything fine. Now I would like to implement the frontends in WP but I do not have any idea how? Maybe you have a tipp for me?

  29. Bob Bob

    Hi, Matheus...

    Do you have any plans to update the plugin for compatibility with the 1.5 version of yourls? I installed yourls 1.5 before noticing your note on compatibility.

    I haven't looked at yourls 1.4 yet, so maybe it will work for me.

    BTW-- The post timestamps in your blog are broken: "%A %B %e%q, %Y @ %I:%M %p"

    Thanks!

  30. Bob Bob

    Sorry-- It's just the post timestamps in the English version of the blog that are are broken...

  31. Hello Dirke,

    I'm not sure if I understand what you want. You want to short your wordpress URL automatically and send it to social networks?

  32. Hello Bob,

    Actually I don't have any plans, when I start developing the plugin I thought the next version of YOURLS will be released soon so I did with the SVN version. I do not intend to dev it to version 1.5. It should not work with 1.4 too and any older releases. You can try to update your files of YOURLS to the SVN ones keeping the database and try if it works (I'm not sure, but I think the database structure is the same so there is no problem). If this works just install the plugin.
    Yeah, I know about this date issue but it is a plugin problem and I'm not really in the mood right now to learn the plugin code and fix it.
    Thanks!

  33. DirkE DirkE

    Hello Matheus,

    I want to integrate your multi-user/index.php-functionality into a page from my blog. (My dream would be, to use the User-Login from wordpress instead of yours...).

  34. Lasse Lasse

    Damn good plugin. But shame you don'T develope any further with captcha function. Right now teh captcha is teh only thing badly missing to get to work ;-(

  35. Hey Lasse,

    Where do you want a CAPTCHA function? Actually multi-user have a CAPTCHA function using re-captcha.
    VARIABLES:
    YOURLS_MULTIUSER_CAPTCHA – Enable user CAPTCHA to Sign in.
    YOURLS_MULTIUSER_CAPTCHA_PUBLIC_KEY – Public API Key to Recaptcha, get yours: https://www.google.com/recaptcha/admin/create
    YOURLS_MULTIUSER_CAPTCHA_PRIVATE_KEY – Private API Key to Recaptcha.
    YOURLS_MULTIUSER_CAPTCHA_THEME – ReCAPTCHA theme.

  36. Lasse Lasse

    Thanks i got it working!!

    Another thing i have to deal with is:
    i can only edit links as admin.
    If a normal user is logged in, he can click
    to edit the link and keyword, but if he clicks "save" nothing happens. Just frozen and you can't click "X" for close, because it is disabled. Any idea how to fix it?

  37. Any idea. I'm not sure if i understand. But I will try to reproduce what I understand and I will reply to you again here.

    Best Regards,
    Matheus

  38. Lasse Lasse

    Hi Matheus,
    thank you for your fast replies!

    Just one more question! I want to check within
    mufunctions.php if the user is already logged in
    in the site.com/admin area. I tried this:

    if ( YOURLS_ADMIN == true )
    {
    //--ok we are logged in as admin
    }

    But for some reason i can't get it to work.
    Do i have to include or call something else before in mufunctions, to get access to this information?

  39. Joe Joe

    yourls seems to be the best and most reputable free url shortnerer script out there. this mulit-user plugin seems more than needed but i don't know how i should proceed... after reading this thread i can't figure out if the plugin works or not AND NOW there's discussion as to whether yourls will incorporate a multi-user feature in a future release. any advise? i'd hate to embrace this plugin, struggle with it then roll out my site if it even works then only to create a mojor gaff with my users because of a yourls update making this plugin obsolete.

  40. Bernhard Bernhard

    At least in my environment the plugin (although activated without problems) didn't run into the tryToInstall() function and thus didn't create the necessary db tables because the yourls_add_action method was called with activated_multi-user instead of activated_Multi-user (note the uppercase M).

    Hope this helps.

  41. Where is the config file located?

  42. Joe Joe

    does the default setup even work?? if not please provide step by step instructions. do i have to edit the config file in order for it to work? why not a simple readme file, do you even provide support for this plugin?

  43. Lasse,
    First of all, I tried to reproduce your problem with edit and save and I didn't have problem. 🙁

    To check if someone is logged in as admin you must use "yourls_is_valid_user();" it returns true if it is admin false if it is not.

  44. Joe,

    I'm trying to keep the plugin update, but while I don't make any money with the website/plugin I can't guarantee the future of it. But I want to keep it update.

    If you look at YOURLS roadmap, you can see on "Future Features" this "User management (multi user, user roles, no more plain text passwords in config file)".

    But the YOURLS is on version 1.5 since Nov, 2010. So I'm not sure when/if this feature will be available on YOURLs.

  45. Bernhard,

    I think this mistake is correct some time ago. Just retried to install and didn't have this problem.

  46. Joe,
    Sorry to take so long to answer your question, I just released a version 1.6 beta where everything is supposed to work. Just tried the setup without any configuration and it works for me.
    I provide support to plugin when I have time, as I said to others, I don't make any money on it, so I can't guarantee that I will spend a lot of time giving support. If someone wants special support/dev, can contact me so we can talk.
    If I start making money on my personal projects, I will start give them more time, otherwise, I can't because sadly I still need to pay my bills.

  47. Joe Joe

    understandable. i'd be willing to make a contribution if it works, i'll give it try.

    maybe i can encourage others to do the same.

    thanks for the fast reply

    give us a link to your other projects!

  48. Thank you so much for this plugin. I need a little help please. When multiple users try to create the same url for instance http://rapidqrcodes.com/order if another user has already create you get the error this http://rapidqrcodes.com/order is already in the database. How do I correct this so that each user can still create a new short url for thei tracking purposes. Thank you. If you need to login to see for yourself email me and I'll give you a login name to get to members area.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.