Moving user under a group during activation [SOLVED]

Moving user under a group during activation [SOLVED]

Monday 30 May 2011 8:40:32 am - 3 replies

Modified on Monday 30 May 2011 10:17:36 am by Lo' F.

Author Message

Lo' F.

Monday 30 May 2011 10:15:31 am

Well, it's done! With or without reply, this forum turns to be always lucky to me!

First of all the right file wasn't activate.php (which is instead related to email activation, I suppose) but setting.php under kernel/user/.

In setting.tpl I also added an hidden field through which pass over the user node id needing to be moved.

<input type="hidden" name="user_node" value="{$user[contentobject][main_node_id]}" />

And in the setting.php file, the rest of the game..

if ( $http->hasPostVariable( "UpdateSettingButton" ) )
{
    ...
    if ( $http->hasPostVariable( 'user_node' ) )
    {
        $userNode = $http->postVariable( 'user_node' );
    }
    if ( $http->hasPostVariable( 'users_groups' ) )
    {
        $usersGroup = $http->postVariable( 'users_groups' );
    }
...

... within the eZOperationHandler else statement..

else
    {
        eZUserOperationCollection:: ...

        eZContentObjectTreeNodeOperations::move( $userNode, $usersGroup );
    }

 

loredanaebook.it

Nicolas Pastorino

Tuesday 31 May 2011 12:24:20 am

Hi Lo' F !

I like the fact that the eZ Community forums are your lucky charm :)

About your solution : it seems fully functional, but it kinda hacks the kernel files, making any future upgrade a bit boring. How about an ajax based solution ? You could keep the template you updated, but simply handle the action through Ajax. This will have you create your own backend, using ezjscore for instance, but will keep your install future-proof.

Cheers !

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Marko Žmak

Tuesday 31 May 2011 2:08:21 am

Hi Lo, there's already a way in eZP to this and it's done like this:

<form action="{'content/action'|ezurl(no)}" method="post">
<input type="hidden" name="ContentNodeID" value="id_of_node_you_want_to_move">
<input type="hidden" name="NewParentNode" value="id_of_parent_node_where_you_want_to_move_it_to">
<input type="hidden" name="ViewMode" value="redirectback">
<input type="submit" name="MoveNodeAction" value="Move user to another group">
</form>

so you don't have to hack the kernel.

Does this help?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

You must be logged in to post messages in this topic!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.