php - Extending & overriding ZfcUser behaviour -
I am using ZfcUser with ht-user-registration and scn-social-auth and there are 2 small improvements I have got to increase my implementation, but I have not had much success yet:
-
ht-user-registration After registering new users get an email And until they've activated their account, it's working fine. What I want to do to increase it, it redirects the user after registration so that they are sent to a page, which is sent to check their e-mails instead of the long page, which is ZfcUser's The default behavior is. I have tried to add the Event Listener to the module bootstrap, which looks like this:
$ response = $ e- & gt; GetResponse (); // It indicates that we want to redirect after the registration process / // home page $ redirection location to $ response-> GetHeaders () - & gt; Set adhidelineline ('location', 'home'); $ Response & gt; SetStatusCode (302); $ Response & gt; SendHeaders (); $ Em = \ Zend \ EventManager \ StaticEventManager :: getInstance (); $ Em- & gt; Attach (Use 'ZfcUser \ Service' User ',' register ', function ($ event) {// this event $ $ event- & gt; StopPropagation (); // Redirect Response Returns $ reaction ;}); It is called correct but redirect is never done and the user just ends up on the login page. Do I have to do something else to execute the redirection? Or maybe there is a better way to achieve this goal altogether?
I would like to add layout variables so that I can modify page titles and navigation in my layout templates for Zyphic user pages. . To do this, I made an override of UserController from ZfcUser like this:
class extends UserController \ ZfcUser \ Controller \ UserController {public function loginAction () {$ this- & gt; Layout () - & gt; Set variables (arrays ('visual_title' = & gt; 'log-in report',)); Return Parent :: Login Action (); }}
and then overwrite the invokable for zfcuser in the config in such a way:
'controllers' = & gt; Array ('application' controller \ '=' Code>
),
The framework tries to instantiate my user controller at the right point, but fails with an invalid order: 'You have a callable redirect Callback must be supplied 'which I can see is the base controller Is required to build but my override version is not passed - why not have a clue? I can not find an example of working for it.
Maybe there is a very easy way to incorporate layout variables into controlling tasks of other modules?
[ Edit] I have not found a simple but very beautiful way of doing this, since my modules override ideas for both login and registration, setting the layout variable within the view It is possible, in this way, I could add a liner at the top of each view to set the layout variable, like:
This does not seem right, but works if I want to know better solution.
Comments
Post a Comment