Textpattern CMS support forum

You are not logged in. Register | Login | Help

#811 2011-09-26 10:46:21

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,314
Website

Re: ign_password_protect

Hi Anura

There is such a feature on mem_self_register plugin (reset password, change password, …).

Cheers

Offline

#812 2011-09-26 11:06:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,754
Website

Re: ign_password_protect

aslsw66 wrote:

I assume there is nothing within the current ign_password_protect functionality to help me out, because it immediately writes to the last_access field in the ign_users table on the first login.

Hmm, yeah a tricky one. Both Txp’s login mechanism and ign_pw_protect set the last_access immediately so I think the only way to do this would be to hack the plugin. Since 4.4.0 you can separate the login process by doing a query-only credentials check without setting the last_access. So this is the process igner would probably use:

  1. check login is valid without updating last_access (call txp_validate() with third arg set false)
  2. assuming (1) passes, test last_access field: set a flag depending on content
  3. call txp_validate() again (with third arg=true or omitted) to set the last_access and log the person in

Once the ign_if_logged_in (or other tag) has been retrofitted with the ability to test the status of the flag set in step 2, it’s game on (at least, I think that’d work).

Last edited by Bloke (2011-09-26 11:11:12)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#813 2011-09-26 14:09:28

aslsw66
Member
From: Geneva, Switzerland
Registered: 2004-08-04
Posts: 338
Website

Re: ign_password_protect

The other option I was thinking was to add a new field to the ign_users table for the first login. If it’s the first login, I could display the welcome message and then update it using smd_query. It doesn’t sound ideal because of (1) overhead from additional database queries and (2) it’s another field to add to the table.

I’ll try to play with both options, but frankly the database route is easier for me (but not everything worth doing in life is necessarily easy!).

Offline

#814 2011-09-26 14:28:27

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,754
Website

Re: ign_password_protect

aslsw66 wrote:

The other option I was thinking was to add a new field to the ign_users table for the first login

If you’re going that route it might be easier to approach it differently with a few lines of php. Something like this (untested):

<txp:php>
   global $variable, $txp_user;
   $users = do_list(get_pref('aslsw66_users', ''));
   if ($txp_user && !in_array($txp_user, $users)) {
      // Person's first login
      $variable['first_login'] = '1';
      $users[] = $txp_user; // Add user to array
      set_pref('aslws66_users', join(', ', $users), 'aslsw66', PREF_HIDDEN, 'text_input', 0); // Store latest user list
   }
</txp:php>

That uses the txp_prefs table to keep a list of people who have logged in instead of faffing about with the users table. From that point on — you can include that code on every page via good ol’ output_form — you can use txp:if_variable to check if it’s first login time.

Last edited by Bloke (2011-09-26 14:32:19)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#815 2011-09-28 21:18:48

aslsw66
Member
From: Geneva, Switzerland
Registered: 2004-08-04
Posts: 338
Website

Re: ign_password_protect

That would still be another database query wouldn’t it? Also, part of me thinks it would be neater to keep all of the data about a user together with their record in the table (don’t talk to me about faffing about with the users table, I’ve already done it and am trying to figure out how to reverse engineer smd_bio to correct that mistake!).

Offline

#816 2011-09-28 21:40:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,754
Website

Re: ign_password_protect

aslsw66 wrote:

That would still be another database query wouldn’t it?

get_pref() doesn’t incur any penalty by default but, yes, set_pref() will add one query when a user logs in for the first time.

Also, part of me thinks it would be neater to keep all of the data about a user together with their record in the table

As you wish.

reverse engineer smd_bio

Good luck with that: I struggled to forward-engineer it ;-)

Of course, you could just add a bio field called first-login or something and ask people not to change it from the admin side (assuming you have smd_user_manager installed). If you don’t use smd_um then you can set that bio field up and just gloss over it when displaying your bio data. Use smd_query to set it to 1 after you’ve tested its value. Note to self: maybe hidden fields might be a useful addition.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#817 2011-12-14 03:36:46

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Re: ign_password_protect

I have installed
mem_self_register 0.9.6 – Default register form works perfect, new users are in new database table and are shown in Admin panel.
ign_password_protect 0.5b4 – Default login form, and lot of mine versions dont work, always it says: “There was a problem logging in.” for new users, who are registred with mem_self_register and for TXP first and other admin users. Maybe someone can help me to activate tis login system?

Offline

#818 2011-12-14 03:51:53

whaleen
Member
From: Portland
Registered: 2006-05-11
Posts: 372
Website

Re: ign_password_protect

elwins wrote:

“There was a problem logging in.” for new users, who are registred with mem_self_register and for TXP first and other admin users.

I posted a reply to another post of yours in this thread.

I had mentioned cbe_frontauth as an alternative to ign_password protect. I don’t want to take away from ign_password_protect as it deeply ingrained now in many projects going forward so no offense intended to Igner. I’m merely seeking the best forward approaches to our questions.

I have been away from Textpattern for about a year and had had many similar questions to yours then. Since returning have had none using cbe_frontauth. May be something to do with cookies. Don’t know.

Perhaps you could give me a login to your site’s install. I’d be happy to help trouble shoot since I am hard at work with TXP again. There is huge potential under way and I’m really eager help and to learn. Also, you speak better English than I do Latvian so a look at your code would help us both.

Last edited by whaleen (2011-12-14 03:53:45)


txtstrap (Textpattern + Twitter Bootstrap + etc…)

Offline

#819 2011-12-14 04:07:56

elwins
Member
From: Latvia
Registered: 2011-08-29
Posts: 80

Re: ign_password_protect

I installed lastest version of ign_password_protect 0.6.2 and Login working, register with
mem_self_register 0.9.6
mem_form 0.8.4
working too, but now is this Error serie:

Ar spraudņa ielādi ir radušās problēmas – Problems with plugin

Ar spraudņa ielādi ir radušās problēmas: ign_password_protect -> Notice: Undefined index:  nonce on line 494
textpattern/lib/txplib_misc.php(653) : eval()'d code:135 ign_doTxpValidate()
textpattern/lib/txplib_misc.php:653 eval()
textpattern/publish.php:118 load_plugins()
index.php:44 include()
tag_error <txp:mem_self_register_form form="u_register_form" /> ->  Notice: Undefined index:  txphorum_mem_Body  on line 27
txphorum_mem()
textpattern/lib/txplib_misc.php:695 call_user_func_array()
textpattern/lib/txplib_misc.php(540) : eval()'d code:203 callback_event()
textpattern/lib/txplib_misc.php(653) : eval()'d code:421 mem_form()
textpattern/publish.php:1188 mem_self_register_form()
textpattern/publish.php:1100 processTags()
textpattern/publish.php:538 parse()
index.php:45 textpattern()
tag_error <txp:mem_self_register_form form="u_register_form" /> ->  Notice: Undefined index:  RealName  on line 457
mem_self_register_form_submit()
textpattern/lib/txplib_misc.php:695 call_user_func_array()
textpattern/lib/txplib_misc.php(540) : eval()'d code:203 callback_event()
textpattern/lib/txplib_misc.php(653) : eval()'d code:421 mem_form()
textpattern/publish.php:1188 mem_self_register_form()
textpattern/publish.php:1100 processTags()
textpattern/publish.php:538 parse()
index.php:45 textpattern()

This is about 2nd month while I am working with Textpattern, and I’m glad that I installed it on my computer! :)

Last edited by elwins (2011-12-14 04:13:48)

Offline

#820 2011-12-14 10:18:31

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,754
Website

Re: ign_password_protect

elwins wrote:

Notice: Undefined index: txphorum_mem_Body on line 27

That implies you’re using TXPhorum. If so, are you using the publicly available version from Ben’s site (v0.3)? There were a number of issues with it that I’ve since tracked down and fixed, which may mend at least one of those two errors.

If you are using it and would like my newer version then just get in touch. Actually I should probably make it available as it is (perhaps as a beta), but I do have a little work to do on it when I get some time. I wanted to rip the default theme apart to make it look prettier out of the box, as well as using it to show off new features like txp-categories-as-sub-forums, and sticky posts.

Either way, both of those errors are just warnings that you can more than likely ignore. If it seems to work, you can take solace in the fact the messages will disappear when you set your site to Live mode.

Last edited by Bloke (2011-12-14 10:19:53)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB