Textpattern CMS support forum

You are not logged in. Register | Login | Help

#21 2011-08-30 09:59:20

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

Re: smd_user_manager: keep large user bases under control

Ah, I just remembered that I don’t allow alteration of the smd_um.* privs in case it blows up the plugin. Although the values are saved to the database I specifically forbid them to be reimported into the page (lines 1229-1232 of the plugin).

If this is a problem, I can take one of two courses of action:

  1. Hide the smd_um strings from the privs pane so you can’t edit them
  2. Allow you to edit them: caveat utilitor!

What is preferred?


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

#22 2011-08-30 15:07:02

laptophobo
Member
Registered: 2010-03-01
Posts: 216
Website

Re: smd_user_manager: keep large user bases under control

Hi Stef, and anyone else. Was checking on #18 above.


Living the Location-Independent Life: www.NuNomad.com

Offline

#23 2011-08-30 15:43:33

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

Re: smd_user_manager: keep large user bases under control

laptophobo wrote:

to have “members” who will have no administrative privileges — only the ability to view password protected Sections of the website

You can add a new group called ‘members’ and just assign no privileges. That would lock such people out of the admin side completely and you can then roll your own front-side login mechanism using this new group. The Privs are only for admin-side access. Combined with rvm_privileged and some login-fu you could run some front-of-house password protection system that required login.

However, sometimes it’s actually more useful to open up a tab or two on the back end and do stuff there. I can recommend smd_tabber (hehe) so you can add a dashboard to the Home tab (a.k.a. tab.start behind the scenes). If you wanted to go this route then just create a new tab on the Home tab from smd_tabber, add that tab and tab.start privs (and perhaps tab.admin + admin + admin.edit if you wanted them to be able to edit their own profile) to your new group and set the Advanced Pref to make the dashboard tab the starting point after login.

Then you can offer a login prompt link from the front of house, it redirects to the standard Txp login box, your members login and the first thing they see is a dashboard. On there you can supply links to cool stuff like “recently viewed” articles or “stuff owned by you” or “membership things to look at now you’re logged in” and so forth, which redirect back to the actual public side articles or resources.

Using the admin side as a halfway public side has some great advantages because pages can be built much quicker than doing it manually on the public side.


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

#24 2011-09-01 13:25:22

Teemu
Member
From: Shanghai
Registered: 2010-04-27
Posts: 60

Re: smd_user_manager: keep large user bases under control

Stef,

Thanks for a great plugin. I have request for little help.

I have manually added some fields to the txp user info and the database table. I’ve added the strings and got additional text fields and text areas working alright, saving and everything, but have problem when trying to use select,radio-buttons and checkboxes.

I can’t really code, but get around by using common logic.

Duplicating the code, I get additional text field to show up in the user info table like this example:

.tr( fLabelCell('Phone', '', 'phone'). fInputCell('phone', $phone, '', 30) , ' class="phone"')

How could I display a select field with lets say two options?

I’ve tried to find some working examples from the source and apply them, with no luck.

Offline

#25 2011-09-01 13:35:33

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

Re: smd_user_manager: keep large user bases under control

Teemu wrote:

I have manually added some fields to the txp user info and the database table.

Is there a reason you did that instead of using smd_bio, which does the hard work for you? The latest beta works with smd_user_manager.

How could I display a select field with lets say two options?

Look at the functions selectInput(), checkbox() and radioSet() in lib/txplib_forms.php. For select lists you set up an array of the values you want:

$select_options = array(
   'key1' => 'value1',
   'key2' => 'value2',
);

And then pass that array as the 2nd argument to selectInput(); — the 1st arg is the select name as used in the HTML form, and the third arg is the value want to be selected by default.

Hope that helps.


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

#26 2011-09-01 14:03:09

Teemu
Member
From: Shanghai
Registered: 2010-04-27
Posts: 60

Re: smd_user_manager: keep large user bases under control

Thanks Stef for the prompt answer.

The reason I’m doing this the hard way, not with smd_bio, is that I’m using mem_self_register and ign_password_protect.

Where do I put that array? I think I have to get that selectInput(); insidea table row and cell, right? It doesn’t work if I put the array inside the row or cell function:

.tr( fLabelCell('Membership', '', 'membership'). td( selectInput('membership',$select_options,'') ) , ' class="membership"')

Offline

#27 2011-09-01 14:11:51

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

Re: smd_user_manager: keep large user bases under control

Teemu wrote:

The reason I’m doing this the hard way, not with smd_bio, is that I’m using mem_self_register and ign_password_protect.

They should all work together in harmony. Is there some incompatibility I don’t know about? If so I’ll fix it if you let me know what’s not working.

Your users can register themselves with mem_self_reg, receive a password, log in using ign_pw_protect (or via the Txp standard login + rvm_privileged) and then you can present them with a form to allow them to alter their own bio. smd_user_manager allows this by default from the admin side, and the new smd_bio has input controls that allow you to build your own input form to capture updates to the fields — either on the public side or via an admin-side dashboard. It’s experimental and still requires mem_form at present, but it should work.

It doesn’t work if I put the array inside the row or cell function

It should do but you need to either put it in directly, or set the $select_options array up before you start to render the labels and cells. The second method would look like this:

tr(
	fLabelCell('Membership', '', 'membership').
	td(
	  selectInput('membership',array( 'key1' => 'value1', 'key2' => 'value2' ),'')
	)
	, ' class="membership"'
)

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

#28 2011-09-01 14:33:12

Teemu
Member
From: Shanghai
Registered: 2010-04-27
Posts: 60

Re: smd_user_manager: keep large user bases under control

I didn’t know that smd_bio could provide the public side updates. I will definitely take a look at that. Email notification to the site admin when user updates fields from public side form, should be possible with smd_bio and mem_form?

And thanks for the code above, it displays the select field with the options. It shows always the first option as selected, could it be possibility to display the saved value instead?

Offline

#29 2011-09-01 14:37:14

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

Re: smd_user_manager: keep large user bases under control

Teemu wrote:

I didn’t know that smd_bio could provide the public side updates.

Well, it’s still in development so it’s not finished yet.

Email notification to the site admin when user updates fields from public side form, should be possible with smd_bio and mem_form?

Ummmm, dunno. Not thought about that. If you trust your users enough to allow them to edit their own bio info, I can’t see a reason for needing to tell an admin of that fact. In a site of 10000 users, that could quickly grow tireseome. But please feel free to enlighten me to a use case and I’ll consider it.

could it be possibility to display the saved value instead?

Sure, just supply the key you want selected as the 3rd argument. You’d have to read the value of the current setting from the database somewhere further up the code and then put that variable name in where you have the '' now.


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

#30 2011-09-01 15:15:52

Teemu
Member
From: Shanghai
Registered: 2010-04-27
Posts: 60

Re: smd_user_manager: keep large user bases under control

Bloke wrote:

Ummmm, dunno. Not thought about that. If you trust your users enough to allow them to edit their own bio info, I can’t see a reason for needing to tell an admin of that fact. In a site of 10000 users, that could quickly grow tireseome. But please feel free to enlighten me to a use case and I’ll consider it.

I know it sounds a bit odd, but the reason for needing it to this client is their member mailing list. So, if a member changes their email address, it is crucial to them to know.

I have thought about mem_postmaster, but integrating that to all this… that goes way beyond my knowledge.

Offline

Board footer

Powered by FluxBB