Forums / Setup & design / Getting notifications from ezpublish

Getting notifications from ezpublish

Author Message

Jorge estévez

Sunday 26 September 2010 7:00:41 am

Hello to all,

 

I am trying to run notifications at a site, I have added myself to the notification page (node 2) trying to be notified each time anything is published.

 

Copied the cronjobs.ini from settings (without modification) to my “siteaccess/esl” and “override” (both) folders at settings as cronjobs.append.php hoping the site will notify me but it doesn’t work at all.

 

Any clues, must have something wrong!

thanks!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Frédéric DAVID

Monday 27 September 2010 1:58:12 am

Hi,

what is eZ publish version used ?

On eZ publish 4.X, you don't have to modify siteaccess ini.

Have you try this command : php runcronjobs.php -s you_steaccess frequent

If this command doesn't work, you can verify if you can send a mail with eZ publish.

Blog : http://www.frefred.fr/blog/ez-publish
feZ Meta Data : http://projects.ez.no/fezmetadata

Jorge estévez

Monday 27 September 2010 9:28:55 pm

Hello,

 

Using ez 4.3

 

I cannot run notifications for my newly installed site.

 

Usually this is an “out of the box issue”, I really don´t know if I have to configure .ini files like notifications.ini or cronjobs.ini for this purpose.

 

I have the following code:

<form method="post" action={"content/action/"|ezurl}>

 

<!--input class="forum-new-topic button" type="submit" value="{'New topic'|i18n( 'design/ezwebin/full/forum' )}" /-->

 

<input value="{$node.node_id}" />

 

<input value="{$node.contentobject_id}" />

 

<input value="{ezini( 'RegionalSettings', 'ContentObjectLocale', 'site.ini')}" />

 

<input class="button" name="ActionAddToNotification" value="Notificame por e-mail{*'Keep me updated'|i18n( 'design/ezwebin/full/forum' )*}" />

 

<input value="{$node.node_id}" />

 

<input value="forum_topic" />

 

</form>

I would like to add node 2 (the whole site) as the beginning of the tree I need to notify everyone that hits the notification button. The form is located at node 378, I wonder if I have to change {$node.node_id} to “2” at every instance in the form.

thanks!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Jorge estévez

Tuesday 28 September 2010 4:57:09 am

Hi,

It's a more general error, when someone registers it does not send an email, when contact form is used it doesn'y either, and notifications do not work...

So it has something to to with the [MailSettings] configuration I assume...

this is my configurations at site.ini.append.php

At settings/override my site.ini has

[MailSettings]
Transport=SMTP
TransportServer=localhost
TransportUser=
TransportPassword=
[email protected]
EmailSender=

At settings/siteaccess/esl the site.ini has

[MailSettings]
[email protected]
EmailSender=

This is a Linux hosting enviroment

Thanks

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Jorge estévez

Tuesday 28 September 2010 5:14:48 am

Hi,

Something must be wrong or missing at lines:

Transport=SMTP
TransportServer=localhost
TransportUser=
TransportPassword=

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Christian Rößler

Tuesday 28 September 2010 5:36:15 am

"

Hi,

Something must be wrong or missing at lines:

Transport=SMTP
TransportServer=localhost
TransportUser=
TransportPassword=

"

When using SMTP you might consider utilizing a username and a password for authentication against your mail-daemon (postfix) on localhost.
I recommend using "sendmail" as Transport for testing purposes. This is the default setting as well and should work without problems.

Use the mail method you want to use on your ezpublish instance according to what you have installed. TransportServer=localhost inherits a installed SMTP-Server (i.e. postfix) on the same host as ezPublish runs.

On the other hand, your form seems a bit skiddish... or so.
You have some input-fields with values, but no name-tags. The module "content/action" which is your form-target cannot determine what to do or what are the values you are about to POST when they have no input-name.

So try to solve the mailproblem first. Let us know,

Chris

Hannover, Germany
eZ-Certified http://auth.ez.no/certification/verify/395613

Jorge estévez

Tuesday 28 September 2010 8:15:58 am

Thanks Ok Ill be back!

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Jorge estévez

Tuesday 28 September 2010 5:40:16 pm

Hello,
Thanks for your help and support
Mail is working fine with "sendmail" instead of SMTP...

Contact form works, new register user works fine, but notification does not work at all. I went to see if I had the appropiate policy for members and that´s ok... I have copy-pasted the form from "forum_topic.tpl" and made some slight adjustements, also commented some lines. The only node that users can subscribe is node 2 so I made the following:
{def
$nodo=2
$nodocontentobject=65}
then the form that instead of getting the current {$node.node_id} and {$node.contentobject_id} it has the value of {$nodo} and {$nodocontentobject}.
This is my form:
<form method="post" action={"content/action/"|ezurl}>
<!--input class="forum-new-topic button" type="submit" name="NewButton" value="{'New topic'|i18n( 'design/ezwebin/full/forum' )}" /-->
<input type="hidden" name="ContentNodeID" value="{$nodo}" />
<input type="hidden" name="ContentObjectID" value="{$nodocontentobject}" />
<input type="hidden" name="ContentLanguageCode" value="{ezini( 'RegionalSettings', 'ContentObjectLocale', 'site.ini')}" />
<input class="button" type="submit" name="ActionAddToNotification" value="Notificame por e-mail{*'Keep me updated'|i18n( 'design/ezwebin/full/forum' )*}" />
<input type="hidden" name="NodeID" value="{$nodo}" />
<!--input type="hidden" name="ClassIdentifier" value="forum_topic" /-->
</form>
This is the form from forum_topic.tpl

<form method="post" action={"content/action/"|ezurl}>
<input class="forum-new-reply button" type="submit" name="NewButton" value="{'New reply'|i18n( 'design/ezwebin/full/forum_topic' )}" />
<input type="hidden" name="ContentNodeID" value="{$node.node_id}" />
<input type="hidden" name="ContentObjectID" value="{$node.contentobject_id}" />
{if $notification_access}
<input class="forum-keep-me-updated button" type="submit" name="ActionAddToNotification" value="{'Keep me updated'|i18n( 'design/ezwebin/full/forum_topic' )}" />
{/if}
<input type="hidden" name="NodeID" value="{$node.node_id}" />
<input type="hidden" name="ClassIdentifier" value="forum_reply" />
<input type="hidden" name="ContentLanguageCode" value="{ezini( 'RegionalSettings', 'ContentObjectLocale', 'site.ini')}" />
</form>
Any ideas??
thanks to all

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Christian Rößler

Wednesday 29 September 2010 2:54:18 pm

Hy Jorge,

I'm glad you got mail working :-)

Theroretically your form should work too. Please find below an example form I used. This is kinda hackish but it should implement the minimum amount of code.

{def $nodo=2
     $nodocontentobject=65}
<form method="post" action={"content/action/"|ezurl}>
    <input type="hidden" name="ContentNodeID" value="{$nodo}" />
    <input type="hidden" name="ContentObjectID" value="{$nodocontentobject}" />
    <input type="hidden" name="ContentLanguageCode" value="{ezini( 'RegionalSettings', 'ContentObjectLocale', 'site.ini')}" /> 
    <input class="button" type="submit" name="ActionAddToNotification" value="{'Keep me updated'|i18n( 'design/ezwebin/full/forum' )}" /> 
    <input type="hidden" name="NodeID" value="{$nodo}" />
</form>

This is what is happening in the background when submitting this form:

First, the kernel-module "content/action" is called. You can find its code in "kernel/content/action.php".
This action.php tries to match several POST variables/keys in order to determine what to to.

In your case it matches the following statement:

else if ( $http->hasPostVariable( "ActionAddToNotification" ) )
{
    $nodeID = $http->postVariable( 'ContentNodeID' );
    $module->redirectTo( 'notification/addtonotification/' . $nodeID . '/' );
    return;
}

You see, it's looking for the POST variable "ActionAddToNotification" which is sent. Then all it does is to redirect to another module which has the correct logic to handle notification requests: "/notfication/addtonotification". It also appends the nodeID of the node you would like to add to your notification list. kinda + hopefully. (What exactly is not working in your case? How 'far' can you go?)

So, now lets look at the code for the notfication module. You can find it at "kernel/notification/addtonotification.php". All code here is more or less straight forward. The important thing is to check, if the actual user is logged in and if the supplied url-nodeid-argument is indeed a valid ezpublish node id and it also checks, if the current logged in user has READ-access to this node.

If everything is ok, the nodeID / node should have been added to the users notfication list. Easy hugh?

But now dont ask me, why in your case nothin happens. Please take a look at your ezpublish logfiles. You can find them in var/log. Go though the last few lines of error.log, warning.log and/or notice.log. My guess is, that somewhere exists an error which prevents the above described behaviour.

As always: have you cleared your cache after modifiying the template? I'm not the great template guy, more the extension and hacking freak. So with template stuff I'm not directly the right one to ask ;-)

Hope you can find it out. cheers,

chris

EDIT: wow. This was the most esthetically post I've every written so far. Its syntax coloring and text-flow is mind blowing ;-)

Hannover, Germany
eZ-Certified http://auth.ez.no/certification/verify/395613

Jorge estévez

Saturday 02 October 2010 6:46:19 pm

Thanks for your very good explanation...

 

Ok, I have been investigating,

 

I am using your form logged as administrator (full access)

 

{def $nodo=607

 

$nodocontentobject=658

 

}

 

<form method="post" action={"content/action/"|ezurl}>

 

<input type="hidden" value="{$nodo}" />

 

<input type="hidden" value="{$nodocontentobject}" />

 

<input type="hidden" value="{ezini( 'RegionalSettings', 'ContentObjectLocale', 'site.ini')}" />

 

<input class="button" name="ActionAddToNotification" value="{'Keep me updated'|i18n( 'design/ezwebin/full/forum' )}" />

 

<input type="hidden" value="{$nodo}" />

 

</form>

 

I came with the following notice at error.log

 

[ Oct 02 2010 00:28:29 ] [127.0.0.1] kernel/content/action.php:

 

The nodeID parameter was empty, user ID: 14

 

 

So I opened addtonotification.php and verified that $nodeID = $Params['ContentNodeID']; was getting the correct nodeID, it's OK.

 

The error is generated at:

 

$contentNode = eZContentObjectTreeNode::fetch( $nodeID );

 

if ( !$contentNode )

 

{

 

eZDebug::writeError( 'The nodeID parameter was empty, user ID: ' . $user->attribute( 'contentobject_id' ), 'kernel/content/action.php' );

 

$module->redirectTo( $redirectURI );

 

return;

 

}

 

The $nodeID is still valid but the eZContentObjectTreeNode::fetch is not working properly (I have made no modifications at all a any .php file) it seem if ( !$contentNode ) is true so the error prints out at the error.log file....

 

I have changed the nodeID to others but the same problem arises with all of them.

 

Any Ideas, Thanks

 

jorge

Diseño Web Cuba
Web Design Cuba
www.elfosdesign.com

Christian Rößler

Sunday 03 October 2010 3:52:29 am

First, your notification-subscription form still has no valid fields.You are using:

<input type="hidden" value="{$nodocontentobject}" />

Html-forms need a name for their value like this:

<input type="hidden" name="ContentObjectID" value="{$nodocontentobject}" />

Second, the errormessage

The nodeID parameter was empty, user ID:14

may be a result of either an empty nodeID parameter as stated or, which is more and more the case, eZPublish could not fetch a node-object by the supplied $nodeID. So please verify the form-post values for NodeID and ContentObjectID. eZPublish distincts between nodeid and contentobjectid. Those are different ids and they have nothing in common when it comes to such php-calls.

Make sure, the supplied nodeID really does exist after fixing the form.Try to call the following url in your browser manually:

/notification/addtonotification/2

and see what happens. You may also replace "2" with your nodeId you wish to subscribe. This is just a test to see that the supplied url-parameter nodeID does exist. If this url throws errors, you do not have the nodeID in your database or do not have the permissions to access this node.

good luck,chris

Hannover, Germany
eZ-Certified http://auth.ez.no/certification/verify/395613