ign_password_protect - revisited

After much teeth gnashing, late night coding, and many, many, many bugs squashed, and new ones created then (hopefully) squashed once again…version 0.4 of ign_password_protect is hereby released to the world.

Download it here. _Update: new version 0.4.2c – see help text for more info.

This version features a significantly re-written authentication mechanism, and more importantly, support for an alternate database. In addition, this version features a number of new tags:

<txp:ign_if_logged_in></txp:ign_if_logged_in>

Conditional to test the state of the login, includes support for <txp:else />. Accepts one parameter, privs.

<txp:ign_self_edit />

Displays a form to allow logged-in users to change their password.

Accepts the following parameters: class, title, onClick, size, tab, id

<txp:ign_page_privs />

Use at the top of a page to set page-wide privilege levels. Useful for enforcing privilege levels across multiple protected elements on a page, as opposed to specifiying privs on each element. Privs set on individual elements will override these global privs.
Accepts one parameter: privs

As always, comments are welcome.

  1. I’ve just installed the ign_password_protect plugin (congrats, it’s very good!) for a Catalan language website and now I’d like to translate the field names in the login form (“name” and “password”). I’ve searched for these values but I’ve not found them in the editable section of the plugin Any idea about where to find them?
    Jordi    Sep 22, 08:41 PM    #
  2. I’ve just installed the ign_password_protect plugin and activated it all was going well with my testing until I restarted the textpattern admin page now i get the following error Fatal error: Call to undefined function: add_privs() in /TextPattern/textpattern/lib/txplib_misc.php(351) : eval()’d code on line 74

    I’ve managed to hack my way in and deactivate the plug in so i’m ok for now but i could really use this functionality. Has anyone out there had this problem and better still found a solution ‘cos i’d really appreciate some pointers?

    Thanx
    ajh    Sep 27, 02:08 AM    #
  3. i was trying to user your plug to password protect the whole site. i ran into a problem with the login not submitting and i thought that this might be a decent bug that i would share with everyone. with my site if the file name is index.php it does not show in the url so the actions for the form had no where to go. here is the fix. replace line 405 ($form_action = substr($_SERVER[‘REQUEST_URI’], 0, strpos($_SERVER[‘REQUEST_URI’], ’?’));) with this $form_action = ( is_null($_SERVER[‘REQUEST_URI’]) ) ? “index.php” : substr($_SERVER[‘REQUEST_URI’], 0, strpos($_SERVER[‘REQUEST_URI’], ’?’)); i noticed this same cod is also on line 251 but i have yet had any problems with it. thanks
    kevin    Oct 6, 05:43 AM    #
  4. wonderful! can’t wait to try this. thanks for working so hard on it :-)
    shafina    Oct 18, 02:21 PM    #
  5. So far this has turned out to be exactly what I was looking for. It works for me with no bugs to report.

    Now I need to figure out how to get more functionality by using the alternative database but I’m no programmer so am not sure where to start. (like how do I set up an ign_user db?)

    What I need to do is allow different people access to different parts of my site – but as far as I can figure, if you have a login for one part, you can access any part of the protected information. I know I can set ‘none’ as privileges in the txp users db so they can’t mess with my site, but what I need is for specific users to see specific information only.

    All pointers gratefully received.

    Thanks for a very useful plugin!
    Steve    Nov 3, 12:18 AM    #
  6. Following previous post – I’ve now figured it out – I’ll pass on what I’ve learned.

    The database ign_user is created and managed through the EXTENSIONS tab in txp – which is NOT VISIBLE when you are looking at the plugin! (click on any other tab in admin and it appears – I have no idea why it should be this way but I’m sure there’s a very good reason).

    Once you decide to use the alternative database, all becomes clear (although I did have to click out and back again to see the imported user names from txp_users). After that it is a simple matter to define access privs and put the password protect tags around txp:article tag in a page template. Then it’s just a matter of posting the articles you want to protect to a section that uses this page template. Perfect. Now I can direct clients to different information, depending on their logins.

    This is a great plugin – thanks a lot.
    Steve    Nov 12, 11:03 AM    #
  7. i really like this – thanks.
    Do you think there could be a log-out function?
    chris    Jan 19, 12:07 PM    #
  8. This is a wonderful plugin! Thank you!

    I have a really minor question though—how do you remove the tags around the “Not Logged In” part? I’ve been going over the php code … I can’t find it anywhere :(

    Thanks for any help.
    Piya    Feb 18, 09:22 PM    #
  9. Piya –
    I assume you’re referring to the paragraph tags.

    In the function ign_logged_user change
    return graf($logged_msg);
    to
    return $logged_msg;

    That should take care of things for you.
    Jeremy Amos    Feb 18, 09:32 PM    #
  10. That took care of the issue perfectly! Thank you for responding so quickly.
    Piya    Feb 18, 10:01 PM    #
  11. Thanks for a lovely plug-in. Very useful!

    One annoyance and a tip to fix it:

    I have two textpattern installs on the same domain, and this plug-in gives “bad cookie” errors.

    To fix it, I edited the plug-in in one installation, replacing every ‘ign_login’ (case sensitive, whole words only) with ‘club_login’ (any name will do). This gives the second set of cookies a different name and avoids the confusion. (Also changes some class names, so watch out for that.)
    Sarah    Feb 27, 06:20 PM    #
  12. I used your plugin to change my blog into a flickr-like blog where there are private and public articles that are mixed. Depending on your log-in status, the articles are shown or not.

    But now I have a very specific question concerning statistics. I am using google analytics to find out what’s going on. How can I use the Funnel Visualisation with your plugin since I cannot edit the onclick-events and they are needed for this function when users log in and the only way I can track this login-process is with using the forms OK-button…?
    Michael    Apr 17, 08:59 AM    #
  13. This plugin is fantastic, thank you! I was wondering however if it is possible for users to reset their own password, without having access to the textpattern admin interface. many thanks!
    kit    May 14, 05:09 PM    #
  14. kit – if you’re using the alternate db, you can use the < txp:ign_self_edit > tag to allow users to change their password. There is not currently a comparable function if using the txp_users database.
    Jeremy Amos    May 14, 05:58 PM    #
  15. ah, I have implemented a page using , but was wondering if there was a way for a user to recover their password without being logged in.. in the off chance that they forget their password.
    kit    May 14, 07:05 PM    #
  16. oops, it ate my txp:ign_self_edit tag :)

    thanks for your help!
    kit    May 14, 07:06 PM    #