[development] core user_login customization -- getting breakout theming AND custom validator working at the same time?

Anth malkouna at yahoo.com.au
Thu May 20 02:05:29 UTC 2010


Hi Ben,

I feel your pain here.  I just went through something similar to have a 
timesheet application up and going.  One content type representing a 
timesheet but users with different roles accessing different 
versions/parts of it at different stages of a workflow.

What I found a reasonably elegant solution and gave me a bit of re-use 
was to set up different templates in the preprocess function (using 
template suggestions) that will load the same content in a completely 
different way.  Using this with a multi form/step I got it all working 
without doing any theme work or worrying how it looked and then added 
all my theme stuff afterwards.  I do totally agree that this can feel 
harder than just writing your own stuff from scratch sometimes though.

Anthony.

On 6:59 AM, Ben DJ wrote:
> Hi again Lee,
>
> On Wed, May 19, 2010 at 2:45 PM, Lee Rowlands
> <leerowlands at rowlands-bcs.com>  wrote:
>    
>> Have you given thought to adding a '#theme' attribute to the form in
>> hook_form_alter
>>      
> I'd looked at, but, tbh, I'm not at a point yet where I've
> 'internalized' this enough to make a sound decision.
>
> Seems that there's almost _always_ another way to do it ;-)  I'm
> bouncing around from doc snippet to doc snippet, generally getting
> each one working relatively quickly&  easily.  That's good.  Trying to
> stitch this all together is proving challenging so far ... waiting for
> the 'lightning bolt'!
>
> I'll share the overall context of what I'm trying to achieve here --
> and ask for comment as to approach.
>
> Here we go:
>
> I want to change the process workflow of form submission&  user auth,
> using, as much as possible, available core tech'y&  modules.  Using
> 'Search' as an example action:
>
> I've 3 user roles,
>
> 	Anonymous
> 	VerifiedHuman
> 	RegisteredMember
>
> On front page, display search bar/box any/ALL users
>
> @ text entry&  Submit of search, interrupt/redirect BEFORE submitting
> to search backend,
>
> 	'store' original search criteria
>
> 	check logged in state
> 	(1) if LoggedIn as RegisteredMember
> 			push original Search to search backend
> 			present search results
> 				include advanced_search option to modify/filter/resubmit search in
> search result form.
> 		
> 	(2) if LoggedIn as VerifiedHuman
> 			display selector
> 			(a) LogIn as RegisteredMember
> 					continue @ (1)
> 			(b) Create new Account
> 					exit search to launch (User Reg) process
> 			(c) Continue as VerifiedHuman
> 					present simple/unmodifiable search results
>
> 	(3) if !LoggedIn, currently Anonymous
> 			display selector
> 			(a) exit to home page
> 			(b) display/submit (re)Captcha
> 					(i)  if success
> 							continue @ (2)
> 					(ii) if fail>= 3x
> 							ban IP from Search form access for 180 min.
> 							exit to home page
>
>
> To get 'this' done, I'm hoping to leverage as much as possible of
> core's user.module&  contrib'd Captcha.module.
>
> I've also started looking at core's Trigger, and contrib Rules.module
> -- but am not convinced they're helpful, or not.
>
> So, that said -- is your suggestion of '#theme' still a good approach?
>   In the meantime, I'll dig @ http://drupal.org/node/751826.
>
> Thanks!
>
> Ben
>
>    


More information about the development mailing list