21
sceilig
Re: Please Help with xoopsmail issue
  • 2006/6/16 3:29

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


I havent looked at your code too deep but I think part of the problem might be this line.
$xoopsMailer->setToUsers($thisuseremail);

SetToUsers would be looking for a User object being passed to it.
Try using
$xoopsMailer->setToEmails($thisuseremail);



22
sceilig
Re: send email with html to site members
  • 2006/5/17 19:24

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


Im using Evennews v2.1 on XOOPS 2.2.4

I also wondered about the templating system in Evennews - there seems to be a section commented out. Perhaps in a previous version you could choose mail templates to use?
The commented out section is just after the Subject row in the messageForm function.



23
sceilig
Re: send email with html to site members
  • 2006/5/17 18:23

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


Glad to hear your were able to implement it tzvook and thanks for testing.
I do see one issue which is that if you also select to have the message sent as a private message, the PM wont show the content of the message correctly (shows as straight html). I have looked at the PM module and its object handler but cant see where the html characters in the message are being translated to their character entities. The database stores the private message correctly as straight html - but doesnt when it renders to the readpmsg.php?

I also decided to use the evennews module, and the hack to get that to work with html emails would be here:

modules/evennews/admin/index.php
In the sendMessage() function just after
$xoopsMailer = &getMailer();

Quote:

$xoopsMailer->setContentType("text/html");
$xoopsMailer->setTemplate('mailusers.tpl');
$xoopsMailer->assign('X_SITENAME', $xoopsConfig['sitename']);
$xoopsMailer->assign('X_SITEURL', XOOPS_URL."/");
$xoopsMailer->assign('X_MESSAGE', $mail_mess);


Of course you would need a html editor like inbetween in your messageForm function (not sure of the line number since Ive hacked this module quite a lot).
Quote:

include_once XOOPS_ROOT_PATH . "/class/xoopseditor/inbetween/forminbetweentextarea.php";
$sform->addElement(new XoopsFormInbetweenTextArea(array('caption'=> _ADM_EVENNEWS_MESSAGE, 'name'=>'mail_mess', 'value'=>$mainemailbodytext, 'width'=>'100%', 'height'=>'250px'),true));



24
sceilig
Re: send email with html to site members
  • 2006/5/17 9:27

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


The XoopsMailer class builds upon the powerful phpmailer email class - this can be used to send emails as text, html or with multipart attachments.

The default setting for content-type in that class is "text/plain" which is why all XOOPS mails go out as text.

I did a quick hack to allow me to control the content-type setting per instance of using the XoopsMailer. So say for most emails being sent out (like forgot password, change email etc) they could appear as text, but if I wanted to have the "Mail Users" admin function send emails as html, I did the following hacks.

1. edit class/xoopsmailer.php and at line 96 (just above var $subject) add a contentType variable
Quote:

// private
var $contentType;


2. in the same file around line 209 (just above setSubject())
Quote:

// public
function setContentType($value)
{
if ($value) $this->contentType = trim($value);
}


3. in the same file around line 399 (just after ($this->encoding)
Quote:

$this->multimailer->ContentType = $this->contentType;


4. Now depending on what module you are using for sending emails to users, you add a couple of fields to your $xoopsMailer instance.
e.g. for sending html emails using the main "Mail Users" administration function, edit this file:
modules/system/mailusers/mailusers.php

At line 157 (just after $xoopsMailer =& getMailer();)
add this lines:

Quote:

$xoopsMailer->setContentType("text/html");
$xoopsMailer->setTemplate('mailusers.tpl');
$xoopsMailer->assign('X_SITENAME', $xoopsConfig['sitename']);
$xoopsMailer->assign('X_SITEURL', XOOPS_URL."/");
$xoopsMailer->assign('X_MESSAGE', $myts->oopsStripSlashesGPC($_POST['mail_body']));


What Im doing here is setting the ContentType to be text/html. Then using a mail template I created called 'mailusers.tpl'. This template (stored in language/english/mail_template/) is essentially a html file containing my website header and footer, as well as XOOPS placeholders for the content of the email (X_MESSAGE) and Name of the website.

This would be a simple example of that template:

Quote:

<html>
<body>
<div style="margin-left: 20px; margin-right:20px;">
{X_MESSAGE}
<br />
<br />
-------------------------------------<br />
Please do not reply to this message.<br />
-------------------------------------<br/ >
<br />
{X_SITENAME}<br />
<A href='{X_SITEURL}'>{X_SITEURL}</a><br />
</div>
</body>
</html>


5. Implement a html editor for creating the body of the email like inbetween or fckeditor. For the "Mail Users" function, you would edit modules/system/admin/mailusers/mailform.php
then uncomment line 82 ($body_text = new XoopsFormTextArea ......)
and put this call to the Inbetween editor instead
Quote:

include_once XOOPS_ROOT_PATH . "/class/xoopseditor/inbetween/forminbetweentextarea.php";
$body_text = new XoopsFormInbetweenTextArea(array('caption'=> $body_caption, 'name'=>'description', 'value'=>$mail_body, 'width'=>'100%', 'height'=>'250px'),true));



I realise some other people on the forums are working on coming up with a full newsletter module but I needed a solution now rather than later for a website I was creating. I cant guarantee that the above code will cause problems somewhere along the line or if there is even a better approach. Most likely certain people using plain text email clients might have problems viewing emails, and also AOL users (html links need to be done a different way). If looking for a more solid approach you would have to hack the xoopsmailer further, and implement some other phpmailer calls
http://phpmailer.sourceforge.net/

It also wouldnt be that difficult to implement the above hack for the evennews module.



25
sceilig
Re: Private Message (PM) Module: How to hack.
  • 2006/5/16 19:00

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


Try tweaking
modules/pm/pmlite.php

Uncomment these two lines:

Quote:

$to_username = new XoopsFormSelectUser('', 'to_userid');
$xoopsTpl->assign('to_username', $to_username->render());


Put in this instead
Quote:

$criteria = new CriteriaCompo();
$criteria->setSort('uname');
$selusers = new XoopsFormSelect("Select Member", "to_userid", array(), 1, '');
$selusers->addOptionArray($member_handler->getUserList($criteria));
$pmform->addElement($selusers);



26
sceilig
Re: Displaying values from a Multiple select box (combobox)
  • 2006/5/16 6:26

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


I find it frustrating to try and develop modules in XOOPS since the documentation about what classes and functions to use is just not available, and the support forums dont work too well in providing answers to these questions.

Anyway after some trawling other modules I found this answer to my own question, in case others stumble across this issue.

If you have a multiselect field (called say member_category) in extended profiles and you want to access the values of that field for a specific user.

Quote:

$member_handler =& xoops_gethandler('member');
$thisUser =& $member_handler->getUser($uid);

$profile_handler =& xoops_gethandler('profile');
$fields =& $profile_handler->loadFields();
$categoryarray = $fields['member_category']->getOutputValue($thisUser));

print_r($categoryarray);


I think not having easy access to info on what XOOPS classes to use means modules can end up not being created as efficiently.



27
sceilig
Re: Custom contact form for members/users that hides recipient email?
  • 2006/5/16 3:18

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


Rennevat,
If you include the source code of that contact.php file, we can troubleshoot what the parse error is.

As for having a form where the general public can email users, I made a copy of pmlite.php from the Private Messages module and hacked it so it could do just that.
Instead of the message getting sent as a private message, I have it being emailed to the user. The email address never shows up as the popup window for sending the message only refers to their user id.
The anonymous user enters their Name and Email Address which then would show up in the email sent to the user.

I wouldnt feel comfortable releasing the code to the general XOOPS public until any holes and bugs in the code were reviewed in detail and I dont really have the time to do that right now. But I could PM you if you wanted more info on it.

My hack is on top of a highly hacked version of xmmemberstats where the general public can view/search a list of all members but to contact them, they have to fill out the popup window. If the member was logged in, they would be able to send them a private message instead, with the member being notified via email as well that they have a private message.



28
sceilig
putting extended profiles to work
  • 2006/5/14 9:56

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


I am enjoying using the powerful extended profiles module and have been creating a custom "members directory" page where I can display the members based on the custom fields I have created.

However, I am having difficulty trying to get my head around this XOOPS task - I have my users categorized by a custom field (e.g. type of business). I would like to display a sortof "Yellow Pages" of my users where they are sorted by these categories - the top level page would be just a listing of all categories which have users beneath them.
From a MySQL standpoint, it involves joining 3 tables - users, user_profile and user_profile_field. But I feel that XOOPS probably has classes/functions that would help me with this?

For other problems I have come across, I felt I would have to create a custom solution, but then would stumble across a post mentioning a specific class/function already in place in XOOPS that accomplishes that task. Im hoping someone may be able to point me in the right direction with this as well??

I dont want to use any of the Yellow Pages modules since that data is not related to users and I would have to enter all my users as businesses in that sortof module - seems overkill.



29
sceilig
Re: Editing language content on the fly
  • 2006/5/14 4:47

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


Thanks Rowd - hadnt seen that in my searching.

I installed the module and played around with it. Its more for translating languages but I should be able to hack it for my needs since it already shows all installed modules, and you can open each language file and edit the variables.

Cheers!



30
sceilig
Editing language content on the fly
  • 2006/5/13 7:05

  • sceilig

  • Just popping in

  • Posts: 53

  • Since: 2006/3/1 1


Is there a module or hack out there that allows one to edit a language file for a module from the Admin area?
I figured if templates can be edited that way, surely it wouldnt be that difficult to edit language files?

--> open the language file
--> load all variables into a long form
--> then write the changes back to the language file

The people I have managing XOOPS sites I create (who aint that techie) would like to update the language used in modules, but changing them via ftp/homesite would be too complicated for them.

Any ideas? Would xLanguage or MultiLanguages be able to do this?




TopTop
« 1 2 (3) 4 5 »



Login

Who's Online

143 user(s) are online (97 user(s) are browsing Support Forums)


Members: 0


Guests: 143


more...

Donat-O-Meter

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

Latest GitHub Commits