Forums / General / Sending Emails on Approval / Rejection

Sending Emails on Approval / Rejection

Author Message

John Smith

Tuesday 21 September 2010 8:25:53 am

I am looking to setup a system in which a user registration needs approval. I think that can be easily achieved by workflow mechanism (Event / Approval and Multiplexer).

What is best way to set or tweak the system where it can send emails to the user once approved or rejected by the approver/administrator.

I am using 4.0.1.. I read somewhere that it is possible in 4.2.0. Please suggest...

Much appreciated.

John Smith

Wednesday 22 September 2010 8:15:20 am

Anybody please???

Andrew Duck

Wednesday 22 September 2010 8:30:21 am

Hi John,

This currently isn't possible as far as I know. When running the user/register process an email will be sent to the user requiring activation irregardless of the event/approval workflow. Unfortunately this actually incurs further problems in that the user/activate script then logs you in automatically - but an unpublished user (unpublished because they are still unapproved in the workflow) does not have any permissions, including anon permissions, so they will see access denied messages for the entire site.

The only workaround appears to be removing the email approval process and modifying or copying the event approval process to send out the email at the end of the process.

I filed a bug about this a month ago http://issues.ez.no/IssueView.php?Id=17145

I haven't tested this against 4.3 or 4.4 to see if was already fixed.

Andrew Duck, Executive Director, Quiqcorp Limited
eZ Certified Developer and Trainer.
Member of the Community Project Board
http://quiqcorp.com | http://twitter.com/andrewduck

Abdelkader RHOUATI

Wednesday 22 September 2010 9:01:51 am

Hi,

I do not have any suggest.

But i'm wondring, if user registration means that a content object will be created using the content class user. Why a simple workflow will not work, like all others content classes ?

TKs

Abdelkader RHOUATI

Blog (french) : http://arhouati.com
----
Extension arh_jdebug : EzDebug using jquery

John Smith

Wednesday 22 September 2010 9:29:41 am

Cheers guys....

@Andrew: I am aware of that problem... Easy way to hack /user/register.php by commenting $user->loginCurrent(); after "Publish" action.

@Abdelkader: Yes, simple workflow works but the problem is to fire emails while approval/denial of the user by the administrator.... Can not find the easy way out....

One more thing, does the system fire any email on content approval/rejections to the creator after the creator added the item to the notifications.

Lets say I am the registered user on the website... I publish some news article which goes to administrator for checking.... Now depending on administrator's action in the "My account-> Collaboration" does the system send any emails to the creator?

Håvard Bergersen

Wednesday 22 September 2010 10:47:41 am

Idea / Question:

Can't you make a Content Edit Handler? Where you check if the current published object is a user, and then do all the logic there? You can set the user to deactivated and so on..

And then you can generate a link to the administrator like the one the system normally sends to the user, where you create a link the admin can click, and the link can go to your own module, where you can approve/reject?

EDIT:

You can make your own "VerifyUserType".

Check site.ini, somewhere around line 470. Read the comments.

I have done this once (just like you describe), and I remember now, that this is how I did it...

Sebastiaan van der Vliet

Wednesday 22 September 2010 11:18:21 am

You could add a group with with more permissions than the standard 'members' group. On user registration you than publish the user with a hidden node to the second group. The moderator then gets a mail to approve or reject the membership. Let me know if you need the code to do this.

Certified eZ publish developer with over 9 years of eZ publish experience. Available for challenging eZ publish projects as a technical consultant, project manager, trouble shooter or strategic advisor.

Andrew Duck

Wednesday 22 September 2010 12:16:39 pm

I don't think you will achieve what you want with the default approve event type.

Why not copy the event type to a new one in your extension and add code to send an email on the approval or rejection of the process?

You can insert a mail event into checkApproveCollaboration in your custom eventtype prior to returning the status. This will then be picked up and processed by the eventtype and an email send after the approver has chosen approve or deny.

Andrew Duck, Executive Director, Quiqcorp Limited
eZ Certified Developer and Trainer.
Member of the Community Project Board
http://quiqcorp.com | http://twitter.com/andrewduck

John Smith

Wednesday 22 September 2010 1:20:17 pm

Thanks all for kind support.

@Sebastiaan: Worth checking the code and the logic if you do not mind sending the code please. Can be useful for another requirement.

@Andrew: To be honest, not an expert in developing the extensions. It would be a great help if you can guide me little bit more. Is there any contribution which I can follow?

Also this means, if I leave the member approval requirement a side, it is not possible to fire any email on content approval/rejections to the creator after the creator added the item to the notifications?

Nicolas Pastorino

Thursday 23 September 2010 3:15:16 am

Hi John,

I'd go the way Håvard suggested : VerifyUserType. More information on the following threads :

  • http://share.ez.no/forums/install-configuration/new-users-are-unlocked-i-want-them-to-be-locked#comment59892
  • http://share.ez.no/forums/developer/automatic-email-with-new-account-activation-info-from-admin#comment55965
  • http://share.ez.no/forums/general/moving-diff-users-into-diff-usergroups-registration#comment37297

Let us know how things go,
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

John Smith

Thursday 23 September 2010 3:32:59 am

Thanks Nicolas, few links you suggested are my own post.

What about the link below. Will it work for simple email notification when the content is approved / denied by the approver/adminsitrator.

http://share.ez.no/forums/install-configuration/workflow-notification

I checked the code, can not find any if($approve) on line 275. If this works, that will save my life...

Anybody tested?

Cheers,

John Smith

Friday 24 September 2010 8:24:48 am

Any body on the following link?

http://share.ez.no/forums/install-configuration/workflow-notification

Nicolas Pastorino

Monday 27 September 2010 10:40:44 am

I just asked for a little precision there. You may want to participate to the thread too !

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

John Smith

Monday 04 October 2010 7:06:16 am

"

I just asked for a little precision there. You may want to participate to the thread too !

Cheers,

"

Still no reply from Gaetano Giunta.....