| Project: | PHPlist Integration Module |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
I am using 7.x-1.x-dev on a new site and it appears the phplistbackend sub-module needs a little more work? I am not a super-experienced module coder, but at first glance it looks like there are some D7 code changes that need to be addressed to get it going.
For example, the code to reveal the newsletter sending option is:
<?php
/**
* Implements hook_form_alter().
*/
function phplistbackend_form_alter(&$form, $form_state, $form_id) {
if ($form_id == 'node_type_form' && isset($form['identity']['type'])) {
$form['workflow']['phplistbackend_newsletter'] = array(
...
?>But a look inside $form['workflow'] for node_type_form shows a different structure than what's used here?
Even if I'm wrong with my analysis of the code, this doesn't appear to work as it did/does in D6.
I've used phplist and the backend module on some other sites (Drupal 6) and if someone can verify this issue independently, I'd be happy to spend a little time working on some patches. Just want to make sure this isn't something already being worked on by someone else.
Comments
#1
This is my first patch ever so please be gentle. This fixes the phplistbackend_get_lists function as it had been using db_fetch_array() which is gone in D7.
#2
Also the query format used here for table name replacement in db_query ({%s}) is incompatible with D7 as per #743090: Using Placeholders for database table names in db_* functions and might need to be fixed elsewhere to get current with the new db scheme.
#3
Hi bradjones1,
I have to confess that I hadn't even started porting PHPlistbackend. It just got in the D7-DEV by default. Thanks for the work you have started on it. Your patch file worked fine and I have applied it to the D7-DEV release. When I get a minute I'll pick up your other points and start cleaning up the rest of this sub-module, although if you have the time to press on with the port, feel free !
Regards,
- Paul
#4
Hey Paul, I've already started working on the other db queries in this submodule, etc... Let me know if you slice off anything to work on so I'm not stepping on your toes. I'll submit a more robust patch later this week probably. Thanks.
-Brad
#5
Hi Brad,
You code away to your heart's content. I'm too busy adding multi-currency support to Ubercart at the moment!!
Regards,
- Paul
#6
brad, I installed your patch, and it allowed me to install the backend module, and see a "my newsletters" tab in the user account.
I click on the account, then on the tab and I get : "PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'theo2010_drupal.phplist_access' doesn't exist: SELECT lid FROM {phplist_access} WHERE lid = :lid AND rid IN (:rid); Array ( [:lid] => 2 [:rid] => 2,3,4,9,10,12 ) in _phplist_get_lists() (line 1144 of /home/theo2010/public_html/drupal/sites/all/modules/phplist/phplist.module)."
I am at my wits end. Of the 30 modules I have needed for drupal 7 almost every single one is broken. I have a client who has been waiting for 3 weeks for a website. To give you an example, I am using phplist, which I have used in the past, because I wasn't able to get simplenews to send html mails. Simplenews is broken. HTML mail is broken. Mime mail is broken. There are no other solutions. Please please please make this work.
#7
Hi TrevorG,
I understand your frustation - but Drupal is a community-developed system, and assuming that the other module developers receive the same level of assistance (financial and development time) as me, it's no wonder that things take a long time to mature. We all have to earn our crust somehow...
Your problem is nothing to do with the phplist_backend module. However, your feedback has enabled me to identify what was wrong and it is now corrected. Please download the latest version once the system updates, uninstall the old one then re-install again, and you should be good to go.
That said, I'll warn you now that the D7 module is still as its name implies - a development version. I have had precious little time to work on it myself, and little feedback from the community, so no guarantees!
Regards,
- Paul
#8
Paul,
thank you for your work. I will not be able to test it for a couple of weeks. I had to find a work around which was to send people over to phplist to subscribe from their registration and user accounts. I will try it out when I begin the next development cycle for this client.
And I absolutely understand that drupal 7 contributed modules are under heavy development. But I made a decision to go with 7 based on:
I have been building websites with drupal since drupal 4.5 or so, and this is the first time I have ever tried to use a new release in a production environment. I absolutely wear all responsibility for making the decision I just think there were a lot of things that suckered me into making that decision. I have learned my lesson.
Regarding your module, I do truly appreciate your work. I believe every module maintainer should set up a chip in so we can at least show a little appreciation.
#9
No news on the latest D7-DEV release, so assuming fixed.
#10
Paul, if it's OK with you I'm going to reopen this to "needs work" since I am back at this project and judging from the 7.x HEAD I just checked out, there's some lingering D6 database code that remains. I will try to post a patch soon, but I'd like to keep this open to reflect the D7 port of this submodule is still in progress.
#11
This patch is relative from phplist module dir and gets the e-mail sending again from node submission.
Since this is now back alive in phplistbackend, should we update the main module page to reflect that you can indeed "send mailshots from within Drupal"? It's been scratched?
#12
Hi Brad,
Thanks for your work on this. Feel free to do whatever is necessary to get this sub-module working properly. I'm sure loads of people will thank you for it! In any case, I'm not working on it at the moment so it won't cause problems. I'll update the project home page too. I've already rolled your patch into D7-DEV for other people to take a look.
Regards,
- Paul
#13
I've installed both PHPlist & Backend in both D6 & D7. The main module works well, but I can't for the life of me figure out the Backend part.
How do I send a node off to PHPlist??
Thanks
-- Cronin
#14
Hi,
Well, this module needed more porting, but I hadn't realised just how much it needed! I've just spent a couple of hours trying to knock it into shape, and I think you'll find the latest D7-DEV release does at least have the basic functionality now and will work as per the README.
Changes:
- debug messages available
- reformatted code
- fixed fundamentally broken code as a result of the conversion to D7
- converted more queries to D7 syntax
Let me know how you get on with it.
Regards,
- Paul
#15
paulbeany: Very fast! And much appreciated!
OK, I don't think the latest DEV worked for me. I can't be sure because neither the README nor the project/phplist page seem to actually describe HOWTO send a mailshot from Drupal. (The word 'backend' isn't even in the README.) I don't mean to be snarky at all, but this is actually pretty common in drupal. One sentence like "Under the edit tab for a node you'll find a link to send a mailshot of that node to an active PHPlist," would be a BIG help! That's just an example, of course, because I don't know if that's true. But so often, one has to simply guess HowTo actually use a module. Sorry. End of snark.
Here's what I did with your latest DEV version. I deactivated, uninstalled then re-installed the latest DEV of the PHPlist Backend module via admin/modules. I looked around for new configurations settings or options. NADA, but I guess that's probably right.
When I pull up a node and click the Edit tab, I get the image shown attached. Apparently an error in line 18 of the module, which is a call to dpm($node). I've no idea what that does, so I stopped there.
If it helps, I expanded the object in the error, with the results below.
Anyway, I'll keep checking back. I'm sure this will be handy for many folks, once it works.
... (Object) stdClass
vid (String, 4 characters ) 7235
uid (String, 4 characters ) 1897
title (String, 27 characters ) Marat Vedernikov, 1931-2011
log (NULL)
status (String, 1 characters ) 1
comment (String, 1 characters ) 2
promote (String, 1 characters ) 1
sticky (String, 1 characters ) 0
nid (String, 4 characters ) 6511
type (String, 5 characters ) story
language (String, 3 characters ) und
created (String, 10 characters ) 1315650633
changed (String, 10 characters ) 1315651540
tnid (String, 1 characters ) 0
translate (String, 1 characters ) 0
revision_timestamp (String, 10 characters ) 1315651540
revision_uid (String, 1 characters ) 1
taxonomy_vocabulary_5 (Array, 1 element)
taxonomyextra (Array, 0 elements)
body (Array, 1 element)
upload (Array, 0 elements)
cid (String, 1 characters ) 0
last_comment_timestamp (String, 10 characters ) 1315650633
last_comment_name (NULL)
last_comment_uid (String, 4 characters ) 1417
comment_count (String, 1 characters ) 0
phplistbackend_nlid (Boolean) FALSE
phplistbackend_status (NULL)
phplistbackend_sendstart (NULL)
phplistbackend_lists (NULL)
print_display (Integer) 1
print_display_comment (Integer) 0
print_display_urllist (Integer) 1
name (String, 14 characters ) mikhailfedorov
picture (String, 1 characters ) 0
data (String, 381 characters ) a:10:{s:5:"block";a:2:{s:5:"forum";a:1:{s:3:"ne...
subscriptions_notify (Boolean) TRUE
print_pdf_display (Integer) 1
print_pdf_display_comment (Integer) 0
print_pdf_display_urllist (Integer) 1
date (String, 25 characters ) 2011-09-10 03:30:33 -0700
revision (Boolean) TRUE
book (Array, 12 elements)
menu (Array, 12 elements)
Krumo version 0.2.1a | http://krumo.sourceforge.net Called from
/home/xxxxxxx/domains_html/drupal-7.8/sites/all/modules/phplist/phplistbackend/phplistbackend.module
, line
18
#16
Hi,
My apologies - I was trying to work too fast and left some stray debug code in there which only works when the Devel module is installed. (That's another common problem with Drupal - those of us who develop contributed modules rarely have enough time as sponsorship is scarce on the ground so we have to fit it in between the day job...)
I have updated D7-DEV and added a README which, I readily admit, wasn't in fact there for this sub-module. I'm sure I've seen some notes on this contributed module somewhere, but I have no idea where! Feel free to suggest any improvements which could be made to it.
Regards,
- Paul
#17
paulbeaney,
OK, I tried the latest DEV. Again: so fast! Much obliged!
I pulled up an existing node, ticked off one of my phplists and tried to save. Result: SQL error: fromfield can't be empty.
Added a line to function phplistbackend_node_update($node):
$message['fromfield'] = variable_get('site_name', 'Drupal') . ' ' . variable_get('site_mail', 'info@example.com');
I also changed 'site_email' to 'site_mail' in function phplistbackend_node_insert($node)
And lastly, I set 'owner' => 1 in function phplistbackend_node_update($node)
So, pretty cool. With those changes the node in question now appears as a message in the PHPlist interface.
Oh, but Paul, I'm Soooo Disappointed! The message just contains the URL of the node in question! That won't do at ALL for me!
I blame myself. I was hoping for a fully themed, HTML mail message loaded into PHPlist. Looks like I'm back to the old cut & paste!
But hey, it's coming along, ain't it? Thanks for all your help, and so prompt too.
-- Cronin
PS -- Shall I put in a feature request for a fully themed HTML message, submitted to PHPlist? It actually may not be quite as impossible as it sounds, by relying on other, existing modules.
#18
Hi,
Thanks for the feedback. I'll look into the code again and try and work out why you still had to fiddle to get it working. That's not normal!
Before you abandon this sub-module, have you tried sending yourself a test message yet? I have never actually used this module myself (and I'm not the original developer) but as I understand it, it uses a feature of PHPlist where you supply a URL in a certain tokenised format and when PHPlist sends the email, it replaces the URL with the content of the page - fully themed.
Can you show me the actual content of the message that gets created?
Regards,
- Paul
#19
Paul,
Well! Really? PHPlist will pick up a URL and theme it and stuff? I'll look into that...
Hmmm, yes! PHPlist supports a placeholder that can go in either the message or the message template. When I tried to send a message straight from PHPlist I got this error:
"PEAR::HTTP/Request is not available," so it failed.
But I expect I can fix THAT, by just configuring PEAR. Haven't done that in years, but shouldn't be too hard. We'll see!
Very exciting. This could be very powerful for me. Thanks!
Now, the email that your module produced sent out this message (munged to show the key parts here):
___________________________________________________________
subject: Marat Vedernikov, 1931-2011
from: International Thermoelectric Society [my site admin email address]
[URL:http://www.its.org/content/marat-vedernikov-1931-2011]
--
Powered by PHPlist, www.phplist.com --
___________________________________________________________
That looks about right to me.
Thanks so much for all your help, and for maintaining this module. I report back after my experiments with PEAR. Fruitful, lets hope.
-- Cronin
PS -- This is the benefit of asking questions: I get to learn new & helpful stuff!
#20
Paul,
Well, I'll be! First, thanks again for the coding, and the advise. The backend module does seem to basically work for me now, and the use of that PHPlist placeholder [URL:http://xxxx] is going to be a lifesaver!
Here are my notes-to-self on how I made this work.
PHPlist Backend module makes use of a PHPlist URL placeholder that can be embedded in either the mail message or templates. Thus, Backend inserts a message into PHPlist with this content:
[URL:http://www.yourdomain.com/yournode]
Then go you your PHPlist admin page, make sure the message is marked to send as HTML, and process the queue.
To work, your server has to have the a PEAR package installed. Mine didn't, and PHPlist threw an error to that effect. Fortunately, my host has a mechanism to install your own PEAR packages, and to tell PHP where to find them. Thus:
On an SSH command line enter:
pear install HTTP_Request
and in the phplist config.php file, add at the end:
$tmpini = ini_get('include_path');
ini_set('include_path',$tmpini.':/home//php');
(Of course, Virginia, you may do that on one line if you prefer).
Amazingly, all seems to work now!
Now, the rendering of the HTML may not be exactly to ones liking. But it's not that bad either!
Thanks again.
-- Cronin
#21
subscribe thx!
#22
I am no longer using this module regularly and so I can't commit to much more on this - sorry. Unassigning.
#23
Is anyone currently maintaining/developing PHPlistbackend.module ???
Or for that matter, is anyone even maintaining the PHPlist Integration Module? (there's a note on http://drupal.org/project/phplist saying theyre wanting someone to take over.....)
I am interested...
#24
Hi,
I wrote to the original author and submitted some changes through him. It seems that he does not have the time to do significant support. Since, I need the module and I have made some changes to it, i will be glad to help you, if you take it over.
#25
Wow that would be fabulous! I use the module extensively and would most most appreciative :)
#26
Well, I would like to.
I have been doing drupal stuff (sites, theming, even wrote a module for drupal 6 to detect when a date field is a holiday or weekend...) for about 2-3 years now. I am sure I am not the best coder ever, and this will definitely be a learning experience, but i NEED the module, and I have been looking for an excuse to spread my drupal wings... Unless anyone else here knows of any other workable mailing list module which will let me turn node data into an email list message...?? anyone?........
ajeancharles--> what is your experience, technical level..... i am just wondering who should 'lead' this thing (if you even wanna call it that)...... I have been doing general systems and web programming for over 10 years now..... just not alot with drupal. but i am determined and i learn quick (and probably not the best speller... haha) , so....
tonight, I am going to start looking at and learning how the code in the module works. I will post more later.
have a chill day
a
#27
I have msg'ed the module owner, ...
I have a server we can develop this thing on too ajeancharles....
Liliplanet--> since you seem in need as well, what can you do to help? are you willing to take on any piece of this?
a
#28
Hi arm75,
Got your message, thanks. Glad to know there are people willing to keep the flame burning!
I suggest you read up on the guidelines here: http://drupal.org/documentation/develop and in particular http://drupal.org/developing/modules for best practice on maintaining the module. You'll also need to mug up on using git - personally I don't find it the most intuitive of version control systems, but you get used to it! I wouldn't have thought you'd need a server somewhere else to develop on - just use the DEV branch to contribute all the changes from everyone involved, and everyone can access it.
I have given you access to write updates to git, and once you and ajeancharles have decided between you who wants to be the owner, I'll do the necessary. I may need to ask Drupal.org administrators to change it over as I am marked as 'locked' on the permissions page. We'll sort it out one way or another!
Thanks again for stepping into the breach.
Regards,
- Paul
#29
Paul,
Thanks for your willingness to let us take over this module. I have spoken with ajeancharles, and we have decided that I am going to be the module owner. Whenever you want to transfer ownership that would be great. I can't wait to dig into this thing and add some features! I guess let me know once you've transferred ownership and if there's anything else I need to do...
Thanks,
Aaron
#30
super fabulous! wish I could help but can only do testing unfortunately, most most appreciated!
#31
testing will totally work! ;)
i'll holla...
a
#32
for those wondering, i am taking over development of this
module soon. had a hd crash this weekend and just now
getting everything back to normal. more to follow.....
a