Comments

markus_petrux’s picture

Just wanted to say that I started to port it, also fixing some minor spelling/hardcoded language issues.

Though, it is a huge job. =:-o ...if anyone else is doing this, please speak up! ;-)

moshe weitzman’s picture

I don't know of anyone doing this. Thanks.

markus_petrux’s picture

moshe, do you know how to translate 'view_private' in hook_user ?

function mailhandler_user($type, &$edit, &$user) {
  // for now, just show the first mailbox address to user.
  switch ($type) {
    case 'view_private':
      if (user_access('edit own blog')) {
        $result = db_fetch_array(db_query('SELECT * FROM {mailhandler} WHERE enabled = 1 ORDER BY mail'));
        if ($result['security'] == 1) {
          $form['mailhandler'] = array('#type' => 'item', '#title' => t('Mail Handler'), '#value' => t('You may post to <i>%sn</i> by sending an e-mail to <i>%e</i>. Be sure to include your password at the top of your e-mail body (e.g. <i>pass=mypassword</i>).', array ('%sn' => variable_get('site_name', 'Drupal'), '%a' => url("blog/$user->uid"), '%e' => $result['mail']));
        }
        else {
          $form['mailhandler'] = array('#type' => 'item', '#title' => t('Mail Handler'), '#value' => t('You may post to <i>%sn</i> by sending an e-mail to <i>%e</i>.', array('%sn' => variable_get('site_name', 'Drupal'), '%a' => url("blog/$user->uid"), '%e' => $result['mail'])));
        }
        return $form;
      }
  }
}

Is it 'view' and showing only to self?

markus_petrux’s picture

StatusFileSize
new36.88 KB

The admin/mailhandler part seems to work (add/edit/del mailboxes). Now, I need to review the rest.

I'm attaching what I have done in mailhandler.module, if anyone wants to test?

Since, I never used this module before I'm going somehow blind, lol

moshe weitzman’s picture

yes, view_private means that only self and admins can see it. like email address field

please have a look at the upgrading page (http://drupal.org/update/modules) to make sure we are catching everything that has changed. you may ask questions here or to me via email as needed. thanks again.

markus_petrux’s picture

Regarding this message, I've been thinking... what about adding an option for each mailbox where admins can choose which roles can post. It would make possible to control who can view this message in hook_user and, more importantly, who can post. ???

moshe weitzman’s picture

Lets not add featrues during this port ... ideally other modules should be informing users about their mailbox capabilities using hook_user(). If I had commit access to blog.module, I would move this message there and let it decide who can post by mail.

jasonwhat’s picture

I'll test once ported. Thanks for your work.

markus_petrux’s picture

StatusFileSize
new1022 bytes

Ok, here we go...

Here's the SQL schema using the new UTF8 stuff

markus_petrux’s picture

StatusFileSize
new37.61 KB

..and here's the whole module script.

There might be some more cleanup to do. Please, let me know.

jasonwhat’s picture

When trying to add a mailbox I get this error:

Fatal error: Call to undefined function: form_textfield() in /home/donorge/public_html/mysite//modules/mailhandler/mailhandler.module on line 613
markus_petrux’s picture

Are you sure you're testing with the script I posted above?

jasonwhat’s picture

markus_petrux’s picture

In that file, line 613 looks like this:

  if ($error = user_validate_mail($edit['mail'])) {

and form_textfield is not used anywhere in mailhandler.module

Strange

jasonwhat’s picture

Ooops. I have a multi-site install and I did have mailhandler elsewhere. Sorry about that. I tested it and it is working well. The only issue I noticed was that I had to add "status: 1" to the defualt commands for stuff to publish, I don't think this was the case with the original module. Another issue that may not matter to many is how to deal with the new tagging in drupal. Could a user simply add category: (red,green,blue) to create new tags with those categories or something?

markus_petrux’s picture

Great it worked! :-)

I believe we have to wait for moshe's input to add/change features. My main goal was to make it work in 4.7

markus_petrux’s picture

The only issue I noticed was that I had to add "status: 1" to the defualt commands for stuff to publish, I don't think this was the case with the original module.

Yup! I forgot to call node_submit before calling node_save. "status: 1" shouldn't be necessary if the poster does not have 'administer nodes' permission.

I'll post another script as soon as I make some tests.

markus_petrux’s picture

StatusFileSize
new37.73 KB

Well, node_submit solved that. Here's the new script.

jasonwhat’s picture

One more bug I noticed. I'm unable to delete a mailhandler mailbox once I've set it up. Clicking the "delete" link doesn't cause any change. Otherwise things seem great. Thanks.

markus_petrux’s picture

StatusFileSize
new37.74 KB

Delete issue fixed.

jasonwhat’s picture

Latest with mailhndler_3: still needed to set the publish status to have the nodes published. The command to choose the filter setting didn't work either and used the default. I set "format: 3" but it still chose the default of filtered html instead of full html. I'll have to test more, but I published one at midnight and it was dated midnight the day before, not midnight of the current day and therefore wasn't posted at the top of the blog list. This could be a Drupal thing with the time and not the module though. The delete is working great, thanks.

markus_petrux’s picture

The published status worked for me when sending an email assigned to a user that has permission to blog, but has not 'administer nodes' access. Could you please check this?

I'll try to see what's going on with the format and date.

@moshe: have you seen the code? is there anything else missing?

moshe weitzman’s picture

i haven't reviewed it yet. if possible please supply a patch so i don't have to generate my own :). i will review very soon.

it is possible that the filter format was not working before the port too. not sure.

@jason - maybe check your settings for the blog content type in admin/settings => content types. you might be unpublishing new nodes by default?

posting of categories worked in 4.6 so it is within scope to assure that they work in the port. if you want to wait on that issue until this port is committedd, i am OK with that.

markus_petrux’s picture

moshe, I changed almost all lines in the script. Check yourself with WinMerge or something like that.

Are you sure you want a patch?

moshe weitzman’s picture

ok, i will generate one myself if needed. thanks.

jasonwhat’s picture

My settings are set so that all blogs are published and have comments enabled, but this isn't the case with mailhandler nodes. I'm mailing from user 1's email so all permissions are set, but I also added myself to another group with "edit own blog" permissions and still notice the problem of blogs not being published. Also, though I doubled checked that comments are default for blogs, they are being disabled for mailhandler published nodes and as stated before the input filters command is having no effect. I'm not seeing any errors in the log. Maybe if these issues can't be replicated I'll list my active modules to see if there is a conflict.

moshe weitzman’s picture

good description. can you try again with a user who does not have admin nodes permission?

when you have admin nodes, the submit code probably expects to see the status checkbox and the promote checkbox and uses their values. if not present (as in this case), they default to false. it would be helpful if they defaulted to the content type setting.

maybe markus_ will have a good idea how to fix. if we need to, we can fix in mailhandler but ideally we fix in node.module

markus_petrux’s picture

UID has 'administer nodes' permission, therefore it doesn't explicitly sets publishing options. It is the same behaviour when UID creates a blog entry interactively. If posting via UID 1's mail you have to set "status: 1" in the command section.

markus_petrux’s picture

Sorry, by "UID", I meant "UID 1".

moshe weitzman’s picture

i opened an issue for the promote/status/sticky problem at http://drupal.org/node/46549

jasonwhat’s picture

I tried it with another user and it did publish properly. However, it still set comments on the node to disabled, even though that isn't the default. It did choose the default input format 1, "filtered html" even though I had specified "format: 3" in the default commands for mailhandler.

benwei’s picture

StatusFileSize
new37.7 KB

Hello,
I was trying this out with the latest Drupal CVS and found one issue: I was getting an error from strtotime saying I was supplying an empty date. I traced it back to line 260 mailhandler_3.module which sets some date fields for the node, but not the actual field 'date' which is what's being looked at in node_validate(). Attached is my updated version.

moshe weitzman’s picture

please upload a patch per http://drupal.org/diffandpatch

benwei’s picture

StatusFileSize
new364 bytes

What would you like me to patch? My change is against the mailhandler_3.module submitted by markus_, which I do not believe has been committed. Previously markus_ had said that almost every line in the script had been changed and asked you if you really wanted one, to which you replied no.

I'm assuming then that you are requesting a patch against the mailhandler_3.module submitted by markus_, which is attached. Let me know if you'd like something different and I can supply it.

Ben

sanduhrs’s picture

StatusFileSize
new46.5 KB

This is a patch against current cvs for all this here.

bohtho’s picture

Could you post the entire module instead of the patch ? There's so many patches and modules posted above..

sanduhrs’s picture

As stated above, it is a patch against current cvs, get current mailhandler here: http://cvs.drupal.org/viewcvs/*checkout*/drupal/contributions/modules/ma... and apply the patch.
If you have problems patching, there's alot of infos here: http://drupal.org/node/22568
vg

karens’s picture

I got 23 out of 23 hunks failed when applying the patch. Can you go ahead and post the patched module just to move things along?

Thanks!

moshe weitzman’s picture

patch works for me. why are there so many lines in the diff that seemingly have not changed? makes a review a bit difficult.

moshe weitzman’s picture

Status: Active » Fixed

what i meant to say is that the patch applied fine

committed to HEAD and 4.7. thanks all.

please report other bugs here. i haven't actually handled mail with this code yet.

Anonymous’s picture

Status: Fixed » Closed (fixed)