Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-10-07 19:08:13

GuyVerville
Member
Registered: 2011-09-21
Posts: 31

Big problem trying to install a self-registering form

I am attempting to install, with the help of ign_password_protect and mem_self_register a system that will allow users to register and being able to see a private section.

Pictures here can explain the problems. With no use of the external database option.

Using the external database option:

And now the fun stuff (sort of):

I am totally lost on this. I am ready to give someone an administrative access to my website to see what I am doing wrong (or not). I hope this can be fixed, because it is rather surprising.

You can try for yourself: My website . You can switch to English.

Last edited by GuyVerville (2011-10-07 19:21:58)

Offline

#2 2011-10-07 19:42:08

GuyVerville
Member
Registered: 2011-09-21
Posts: 31

Re: Big problem trying to install a self-registering form

Please wait before replying. I might have found something.

Offline

#3 2011-10-08 15:48:14

GuyVerville
Member
Registered: 2011-09-21
Posts: 31

Re: Big problem trying to install a self-registering form

I have found, I think, somewhat the culprit. I hardcoded the level to which the user will get while subscribing. Level 0 doesn’t work at all with ign_password_protect. So I decided to give the new user a Level 6 (which was edited with smb_user_manager to remove any editing capability). The ign_password_protect plugin is also broken regarding its own table. mem_self_register is not able to “talk” to it. Also mem_self_register does not allow insertion of the Textpattern variable tag (i was trying to dynamically translate the self-regristring form).

I do hope user management will be enhanced in the next version of Textpattern. I would like to hear from your experience on these topics and how you would program a multilingual site allowing visiting a private section (we are not talking here about eventual authors or collaborators, just registered visitors).

Offline

#4 2011-10-10 11:53:15

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: Big problem trying to install a self-registering form

I agree that I would like to see integrated user management but more probably as a plugin rather than core functionality.

However, I am getting some success with what you are trying to achieve. My needs are specific to a small community organisation, where members are known to the organisation (ie. no self registration).

  • the core site is protected by ign_password_protect using the separate users table.
  • by design, ign_password_protect locks out people with privileges of 0 ie. you can be a registered user but have no access. This works well for me, because over time we lose contact with people eg. they don’t pay their fees, they don’t turn up to training, etc. This functionalitz allows me to call some people active (priv=6) and others inactive (priv=0) without having to actually remove them from the table. Inactive users get a special message when they visit the site.
  • officers have a higher privileges level but I have reserved priv=1 for a special, super user ie. me!
  • I have built (well, still building) a custom back-end for officers to manage content, members’ information etc.
  • this back-end uses mem_self_register form to allow officers to create new users.
  • I have also used mem_profile a lot to allow users and officers to see items drawn from the user table.

As I say, all of this works although it took a fair bit of thinking about how to join it all together.

Offline

#5 2011-10-10 12:13:10

GuyVerville
Member
Registered: 2011-09-21
Posts: 31

Re: Big problem trying to install a self-registering form

Thanks for sharing this. If Textpattern has to revive, the essentials should not be left unattended and user management is certainly one of those essentials. My problems were that i didn’t want any access to the admin side, but only to a sensitive part of my site.

It’s like having to register to buy a product (but here, without buying anything, just looking!). This makes me thing that I should have looked at the e-commerce plugins available :-)

Things could get trickier if I wanted visitors to subscribe for making comments to the blog part of the site! (promenades).

Offline

#6 2011-10-10 12:19:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Big problem trying to install a self-registering form

GuyVerville wrote:

I hardcoded the level to which the user will get while subscribing

In what way is it hard-coded? mem_self_register allows you to set a preference dictating the user level that new self-subscribers will get. I would try and avoid level 0 since its usage changed recently to mean “no way” rather than “you can login but see no tabs”.

Having said that I’ve just implemented a validation system using mem-self-reg whereby the user accounts are all created with privs=0. The self-reg thanks form contains a call to smd_access_key which makes a unique one-time activation link in the thanks email. When clicked the smd_access_protected destination validates the key and, if successful, elevates their privs to ‘7’ which is a custom priv level I set up using smd_user_manager. They can then log in and see the private section I made for them. A dedicated admin-side dashboard is equally valid here.

mem_self_register does not allow insertion of the Textpattern variable tag

Where does it not allow it? It should permit it in the thanks form because it’s parsed by Textpattern. And you can use them in the mem_self_reg attributes using standard tags-in-tags conventions. Please supply some code example that doesn’t work and we can try to find out why.

user management is certainly one of those essentials

Depends what type of site you’re constructing. There are plenty of varieties of site that don’t need it and such a core inclusion would then be considered ‘bloat’.

But, yes, the overall aim is to improve the situation. As aslsw66 says, it will probably be in the form of enabling plugins to integrate better and provide this kind of front-end management, rather than being a core admin screen.

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


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

#7 2011-10-10 12:33:42

GuyVerville
Member
Registered: 2011-09-21
Posts: 31

Re: Big problem trying to install a self-registering form

In what way is it hard-coded? mem_self_register allows you to set a preference dictating the user level that new self-subscribers will get. I would try and avoid level 0 since its usage changed recently to mean “no way” rather than “you can login but see no tabs”.

I have not seen that preference setting. Where is it? I replaced in the code the default “0” buy “6”.

Having said that I’ve just implemented a validation system using mem-self-reg whereby the user accounts are all created with privs=0. The self-reg thanks form contains a call to smd_access_key which makes a unique one-time activation link in the thanks email. When clicked the smd_access_protected destination validates the key and, if successful, elevates their privs to ‘7’ which is a custom priv level I set up using smd_user_manager. They can then log in and see the private section I made for them. A dedicated admin-side dashboard is equally valid here.

This is perhaps just above my basic knowledge of PHP, but this is indeed the right behavior I wanted to get… and translatable, I have english and french users.

mem_self_register does not allow insertion of the Textpattern variable tag
bq. Where does it not allow it?

My goal was to translate the form.

At the start of the code, I have set some french texts in the variable like this: <code>$variable[‘nom’] = “Identifiant”;</code>

In the self registering form, I tried:

<code> <txp:mem_self_register_form>
…. <txp:mem_form_text name=“name” label=”<txp:variable name=‘nom’ />” /><br />
…. <txp:mem_form_submit /> </txp:mem_self_register_form>
</code>

It broke the code.

I think I have tried also:

<code>$variable[‘nom’] = ‘Label = “Identifiant”’;</code>

Maybe I am all wrong…

It should permit it in the thanks form because it’s parsed by Textpattern. And you can use them in the mem_self_reg attributes using standard tags-in-tags conventions. Please supply some code example that doesn’t work and we can try to find out why.

user management is certainly one of those essentials

Depends what type of site you’re constructing. There are plenty of varieties of site that don’t need it and such a core inclusion would then be considered ‘bloat’.

But, yes, the overall aim is to improve the situation. As aslsw66 says, it will probably be in the form of enabling plugins to integrate better and provide this kind of front-end management, rather than being a core admin screen.

Offline

#8 2011-10-10 12:39:58

GuyVerville
Member
Registered: 2011-09-21
Posts: 31

Re: Big problem trying to install a self-registering form

I would had, for the translating part, that Drupal has a fine way to do things. Any text included in a t() function will be available for translation, Drupal being smart enough to index all those texts for a possible translation. This eases the programmer’s task. You can, of course, build separate .po files, but you can leave also to the one who will use your plugin to translate or not the thing.

I know you have a gTxt() similar function, but I don’t think we can search for translatable strings.

Offline

#9 2011-10-10 12:52:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Big problem trying to install a self-registering form

GuyVerville wrote:

I have not seen that preference setting. Where is it? I replaced in the code the default “0” buy “6”.

Eeek, change that back then look in Admin->Preferences->Advanced. Probably somewhere near the bottom is a self-register section and a dropdown to allow you to pick the default user privilege for new accounts.

This is perhaps just above my basic knowledge of PHP, but this is indeed the right behavior I wanted to get

I didn’t use any PHP. Well, ok, maybe one line because I was lazy. I could have used the smd_query plugin instead.

I have english and french users.

MLP is the best way to go about it. Although it’s a mod (not a true plugin), it allows you to write renditions of articles in each language and switch between them, leaving the pack to handle the drudgery.

You also get some handy conditional tags so you can detect which language a user is using and return approriate content manually. Alternatively there’s the poor man’s approach with which you’re no doubt familiar.

My goal was to translate the form.

In MLP you can create snippets — translatable strings, one for each language — and use them in Forms.

I have set some french texts in the variable like this: $variable['nom'] = "Identifiant";

You may not need to do that as you can achieve the same with:

<txp:variable name="nom_fr">Identifiant</txp:variable>
<txp:variable name="nom_en">Login</txp:variable>

And then if you grab the language string from the cookie or URL (MLP does this for you) you can append it to the end of any future variable name requests, e.g. <txp:variable name='nom_<txp:variable name="lang" />' />

But if you want to continue with the PHP route you need to make sure to use global $variable; to import the txp:variable scope to your php block.

In the self registering form, I tried <snip>

Try swapping the single/double quotes over. Single quotes around a tag-in-attribute indicate it should be parsed:

<txp:mem_form_text name="name" label='<txp:variable name="nom" />' />

I know you have a gTxt() similar function, but I don’t think we can search for translatable strings.

For plugins we have Textpacks. Plugin authors have thus far been slow to adopt these, and it’s primarily my fault. When the new textpattern.org comes online with its community resource documents, and I get time to finish the new ied_plugin_composer (which supports Textpacks natively) I’m hoping the uptake will increase.

EDIT:

Any text included in a t() function will be available for translation

That’s what MLP snippets do. You define a value called ##my_translatable_string##, the plugin automatically picks it up and allows you to define all the strings in any other languages you have installed. The correct language string is then picked based on the user’s language choice (or you can of course display the correct one using gTxt() manually).

Last edited by Bloke (2011-10-10 12:57:04)


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

#10 2011-10-10 12:56:33

GuyVerville
Member
Registered: 2011-09-21
Posts: 31

Re: Big problem trying to install a self-registering form

Thank you for your diligent reply. I just revisited your menagerie. I’m impressed, and sure I need to be more TXP proficient :-)

Offline

#11 2011-10-10 12:59:28

GuyVerville
Member
Registered: 2011-09-21
Posts: 31

Re: Big problem trying to install a self-registering form

Eeek, change that back then look in Admin->Preferences->Advanced. Probably somewhere near the bottom is a self-register section and a dropdown to allow you to pick the default user privilege for new accounts.

Not in sight, and this is the problem with this plugin. It doesn’t install itself correctly! The start install wizard on the help page doesn’t work! It directs me to a restricted area!

Offline

#12 2011-10-10 13:03:22

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Big problem trying to install a self-registering form

GuyVerville wrote:

I just revisited your menagerie. I’m impressed

Thanks. Hope some of it’s genuinely useful .

and sure I need to be more TXP proficient :-)

:-) That’s what we’re here for: to give you a boost to get you over the learning hump.

To be fair you’ve jumped in at the deep end a bit with front-end logins and multi-linguality, especially when things like ign_password_protect are suffering a little from not being regularly updated. I’m impressed you’ve got this far in such a short space of time given the amount of Txp knowledge it requires to implement.


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