1
Daigoro
Quick petition (Survey hack)
  • 2006/10/26 14:43

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


A short while ago, I suddenly found myself needing a way to make a petition, that would verify the persons participating.
I needed it pretty fast, too, so I had to locate something that either did what I needed or could be quickly modified.

The petition I did just ended, and I have removed the code and module from the active site. While doing so, I thought I'd share what I did.

Looking around in the repository and on the web, I found nothing that really fitted my needs.

However Mithrandir's Survey module looked promising to be modified to fit my needs.
It allowed me to make a survey, add the questions I needed answering, export collected data and it even did IP, Cookie or Email verification on the participants.
What it really missed, was some kind of feedback, which I decided would be easiest to add as XOOPS Custom Blocks.

So I made a survey, asking for Name, Address and Email (in that order) - all had to be answered. The address was a text-field, the others only text-strings.

Then I made two Custom Blocks (type = PHP). One to show the current count of participants - and one to display the names of the last 10 people to sign up.

The counter required the following code:
global $xoopsDB;
 
$xoopsDB =& Database::getInstance();
 
$res $xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix("survey_reply")." WHERE formid=1");
 list(
$count) = $xoopsDB->fetchRow($res);
 echo 
'
  <center>
  <b>Currently</b><br />
  <font style="font-size:20px;font-weight:bold;color:#B70000;">'
$count .'</font><br />
  <b>answers.</b>
  </center>
 '
;

Inside the above code, I also had a "Click here to participate", that would link directly to the active survey.


To list the last 10 names, I used the following code:
global $xoopsDB;
 
$xoopsDB =& Database::getInstance();
 
$res $xoopsDB->query("SELECT answer FROM ".$xoopsDB->prefix("survey_answer")." WHERE qid = 1 ORDER BY replyid DESC LIMIT 10");
 while ( list(
$answer) = $xoopsDB->fetchRow($res) ) {
 echo 
ucwords(strtolower($answer))."<br />";
};


I also had to make a few hacks to the module:

This code in survey/form.php had to be fixed
$form->assign(&$xoopsTpl);


so it was changed into:
$form->assign($xoopsTpl);


and finally, I didn't like the way a survey ended, so I did some modifications to survey/submit.php.
This code:
echo $myts->displayTarea($form->f_submit_message1);


was changed into:
redirect_header(XOOPS_URL,5,$myts->displayTarea($form->f_submit_message1));



All of this has worked perfectly, and has been working for about two months now. (But looking at the code to list the names while writing this text, I think it may fail if more then one survey is active.)

I hope you can make use of the above to make your own petitions.
Best regards,
Daigoro



2
Daigoro
Re: Somethings fishy with email sending from newer xoops versions...
  • 2006/10/14 13:40

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Peekay et al.,

The problem observing isn't only with the 'return-path', although it's the easiest observable variable.

Alienhand opened a bug-report on SF, with the 'return-path' issue, and a fix has been made for that.
I opened another bug-report, where the 'return-path' issues was included but which included a more in-dept test of errors. This bug-report was cancelled as it was said to be a clone of the 'return-path' bug-report.

Here's an attempt at describing how the headers are build when an email is send from within xoops:

1. An empty email template is created.
2. Default, often wrong, header values are inserted.
3. XOOPS system assigns new values to many of the default header values (such as the return-path, and from variables).
4. The modules (or XOOPS system) assigns text to the template, and assigns even more values to the header. (Such as the message-body, who the message is to, etc.)
5. Finally the entire template is send to the mailer, to be converted into a real message and to be send to the world.

The 'return-path' error happened at point 3, and resulted in two return-paths being inserted. One correct and one empty.
And the empty one would trigger the insertion of a (often) wrong return-path by send-mail if the provider had set up php to start send-mail using -f. In many cases it would also make providers limit the amount of emails send to only a few every minute.

But many other header related errors happen between point 3 and 4.
I've not been able to test it, but I believe earlier versions of XOOPS did assign more variables per default (at point 3), making system and module designers not add enough variables (at point 4). And this is what now makes many modules and parts of the system break when trying to send emails.

I haven't had time to dig into the code, but now I'm supposed to have a week of vacation, so I hope to be able to get enough time to look at it.
Best regards,
Daigoro



3
Daigoro
Re: Looking for the xoopsmembers module
  • 2006/9/16 9:47

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


I, too, have it working flawless on my 2.0.15 sites.

What does the magic ink say on your blank screen? (Select the page, then press CTRL+A to select all)
Best regards,
Daigoro



4
Daigoro
Re: Somethings fishy with email sending from newer xoops versions...
  • 2006/9/16 9:44

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


@ananda:
It will require (atleast) a rewrite of the xoopsmailer and xoopsmultimailer classes, to use swift instead of phpmailer.

It would be nice to have a modern mail system, but I guess the priority should be to iron out the bugs thats allready present in the system before the message reaches the final destination. When that is flawless, then it will be easier to add new mailer systems.
Best regards,
Daigoro



5
Daigoro
Re: Changing Default Notification Method for ALL New Users
  • 2006/9/14 21:54

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


This should be the correct way to make the notification per email the default for new members.

Edit xoopsroot/kernal/user.php and locate this line:

Quote:
$this->initVar('notify_method', XOBJ_DTYPE_OTHER, 1, false);


Change it into:

Quote:
$this->initVar('notify_method', XOBJ_DTYPE_OTHER, 2, false);
Best regards,
Daigoro



6
Daigoro
Re: Tinyeditor, News and images...
  • 2006/9/10 12:46

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


You are correct (as usual).

I'll send further info to you in PM.
Best regards,
Daigoro



7
Daigoro
Re: Tinyeditor and different css classes for tables
  • 2006/9/10 12:29

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Works like a charm. Thanks.

Now I just have to find out with this TinyEditor related issue, to have a working site.
Best regards,
Daigoro



8
Daigoro
Re: Tinyeditor, News and images...
  • 2006/9/10 12:13

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


I did some more testing, and it seems I loose all formatting done in TinyEditor whenever I save the page.

I think I read about a similar problem in the forum, but now I can't find it.
Best regards,
Daigoro



9
Daigoro
Re: Tinyeditor and different css classes for tables
  • 2006/9/10 11:50

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Ahhh...
I see.
I did indeed read that I could add a specific css file, but I missed the meaning.

I'll try your advice at once.
Best regards,
Daigoro



10
Daigoro
Re: piCal Mini Calendar Block - Help change font size needed
  • 2006/9/10 10:41

  • Daigoro

  • Quite a regular

  • Posts: 223

  • Since: 2003/7/3 2


Forgot to mention this site, the home of piCal. A good place to ask piCal related questions.
And the latest version of piCal is available for download.
Best regards,
Daigoro




TopTop
(1) 2 3 4 ... 21 »



Login

Who's Online

199 user(s) are online (45 user(s) are browsing Support Forums)


Members: 0


Guests: 199


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Feb 29
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits