1
deka87
Your email visible in Profile module
  • 2009/1/4 12:24

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Hi,

Is there a way to create some kind of contact form (e.g. those used to contact administrator or in the catads module when you are contacting an ad poster) to implement into the profile module as a way to contact the user instead of PM and direct emails. The thing is that showing a user's email address is not good for his/her privacy and PM is not enough 'cos anonymous can't use it and it doesnt send a message to an email adress directly.

Maybe I could use for example Contact Us module and replace the admin email adress with something like $thisUser->getVar('email')? I am not sure how to do this tho'
Mind anchors

2
deka87
Re: Your email visible in Profile module
  • 2009/1/4 12:29

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


and one more thing. when you do any search in profile/search.php it shows users' emails in the results. How do I hide it?
Mind anchors

3
ghia
Re: Your email visible in Profile module
  • 2009/1/4 13:20

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


Maybe one of the member modules have such a funtionality?
Quote:
when you do any search in profile/search.php it shows users' emails in the results.
It should only show email addresses from users, which wanted that the email address in their profile is visible.

4
deka87
Re: Your email visible in Profile module
  • 2009/1/4 16:32

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


Quote:
It should only show email addresses from users, which wanted that the email address in their profile is visible.


yeah, but how do I hide the whole column containing emails in the search results?
Mind anchors

5
deka87
Re: Your email visible in Profile module
  • 2009/1/4 17:39

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


as in regard to the contact form...

I took the guts from catads module contact scripts and got this: http://7.pdvop2sz.z8.ru/modules/profile/userinfo.php?uid=1 (please click email icon to see it in action) but as you can see it doesnt load the form. here is a working sample in catads module: http://7.pdvop2sz.z8.ru/modules/catads/adsitem.php?ads_id=12. I seem to change all variables but it doesn't work. Could you please check the final scripts? Seems like it requires 2 files: contact.php and form_contact.inc.php.

contact.php

$op 'form';
foreach (
$_POST as $k => $v) {${$k} = $v;}
foreach (
$_GET as $k => $v) {${$k} = $v;}

if ( isset(
$preview)) {
    
$op 'preview';
} elseif ( isset(
$post) ) {
    
$op 'post';
}

function 
displaypost($title$content) {
    echo 
''.$title.''.$content.'';
}

switch(
$op) {
    
case 
"post":
    global 
$xoopsConfig;
    include(
"../../mainfile.php");
    
$ts =& MyTextSanitizer::getInstance();
 
        
$fullmsg _MD_CATADS_FROMUSER.$name_user "._MD_CATADS_YOURADS." ".$xoopsConfig['sitename']." :nn";
        
$fullmsg .= $title."n";
        
$fullmsg .= "-----------------------------------------------------------------n";
        
$fullmsg .= "$messagenn";
        
$fullmsg .= "-----------------------------------------------------------------nn";
        
$fullmsg .= _MD_CATADS_CANJOINT.$email_user";
        if (
$phone !='')
            
$fullmsg .= 'n'._MD_CATADS_ORAT.$phone";
            
        
$xoopsMailer =& getMailer();
        
$xoopsMailer->useMail();
        
$xoopsMailer->setFromEmail($email_user);
        
$xoopsMailer->setFromName($xoopsConfig['sitename']);
        
$xoopsMailer->setToEmails($email_author);
        
$xoopsMailer->setSubject(_MD_CATADS_CONTACTAFTERADS);
        
$xoopsMailer->setBody($fullmsg);
        
$msgsend "";
        if ( !
$xoopsMailer->send()) {
            
$msgsend .= $xoopsMailer->getErrors();
        } else {
            
$msgsend .= "

"._MD_CATADS_MSGSEND."

"
;
        }
        
$msgsend .= "javascript:window.close();">"._PM_ORCLOSEWINDOW."
";
        echo 
$msgsend;
    break;
    
case 
"preview":
    include(
"../../mainfile.php");
    
$ts =& MyTextSanitizer::getInstance();
    
xoops_header();

    
$p_title $title;
//    $p_title = $myts->makeTboxData4Preview($p_title);
    
$p_title $ts->htmlSpecialChars($ts->stripSlashesGPC($p_title));
    
$p_msg _MD_CATADS_FROMUSER.$name_user "._MD_CATADS_YOURADS." ".$xoopsConfig['sitename']." :";
        
$p_msg .= $title.'';
        
$p_msg .= "-----------------------------------------------------------------";
        
$p_msg .= $message.'';
        
$p_msg .= "-----------------------------------------------------------------";
        
$p_msg .= _MD_CATADS_CANJOINT.$email_user";
        if (
$phone !='')
            
$p_msg .= ''._MD_CATADS_ORAT.$phone";

    
$p_msg .= '';
    
displaypost($p_title$p_msg);

    
$title =  $ts->htmlSpecialChars($ts->stripSlashesGPC($title));
    
$message =  $ts->htmlSpecialChars($ts->stripSlashesGPC($message));
    
    include 
"include/form_contact.inc.php";
    
xoops_footer();
    break;
    
case 
"form":
default:

    include(
"../../mainfile.php");
    
xoops_header();
       
$member_handler =& xoops_gethandler('member');
    
$thisUser =& $member_handler->getUser($uid);
    
// initialisation variables    
    
$message '';    
    
$phone '';    
    
$name_user '';    
    
$email_user ='';
    
$email_author $thisUser->getVar('email''E');
    
$title "Regarding your profile on FreelancerSupport.com";
    if(
$xoopsUser) {
        
$name_user = ($xoopsUser->getVar('name')!='')? $xoopsUser->getVar("name") : $xoopsUser->getVar("uname");
        
$email_user $xoopsUser->getVar("email""E");
    }

    include 
"include/form_contact.inc.php";
    
xoops_footer();
break;
}


form_contact.inc.php:

include XOOPS_ROOT_PATH."/class/xoopsformloader.php";

$form_contact = new XoopsThemeForm(_MD_CATADS_CONTACTAUTOR"form_contact""contact.php");

$title_text = new XoopsFormText(_MD_CATADS_TITLE"title"52100$title);
$form_contact->addElement($title_texttrue);

$name_text = new XoopsFormText(_MD_CATADS_YOURNAME.'*'"name_user"50100$name_user);
$form_contact->addElement($name_texttrue);

$email_text = new XoopsFormText(_MD_CATADS_YOUREMAIL.'*'"email_user"50100$email_user);
$form_contact->addElement($email_text,true);

$phone_text = new XoopsFormText(_MD_CATADS_YOURPHONE"phone"2020,$phone);
$form_contact->addElement($phone_textfalse);

$annonce_text = new XoopsFormTextArea(_MD_CATADS_YOURMESSAGE.'*'"message"$message);
$form_contact->addElement($annonce_texttrue);

$button_tray = new XoopsFormElementTray('' ,'');
$button_tray->addElement(new XoopsFormButton('''preview'_PREVIEW'submit'));
$button_tray->addElement(new XoopsFormButton('''post'_SEND'submit'));
$button_cancel = new XoopsFormButton('''cancel'_CANCEL'button');
$button_cancel->setExtra("' onclick='javascript:window.close();'");
$button_tray->addElement($button_cancel);

$form_contact->addElement($button_tray);

$form_contact->addElement(new XoopsFormHidden('email_author'$email_author));

$form_contact->display();


maybe I missed something...
Mind anchors

6
trabis
Re: Your email visible in Profile module
  • 2009/1/4 18:33

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


where are the files located?
this works
http://7.pdvop2sz.z8.ru/modules/catads/contact.php?ads_id=12

and this will not(this is what your javascript is loading)
http://7.pdvop2sz.z8.ru/modules/catads/contact.php?ads_id=1
because there is no ad number 1

so where are this files you made?
Should not the javascript be pointing to modules/profile/contact.php ?

7
deka87
Re: Your email visible in Profile module
  • 2009/1/4 19:35

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


So i forgot to change the link in the userinfo.php. to modules/profile/contact.php. now it's being loaded alright. anothe rproblem is that it doesn't send emails. guess i messed somethign up in the finla part of contact.php:

default:

    include(
"../../mainfile.php");
    
xoops_header();
       
$member_handler =& xoops_gethandler('member');
    
$thisUser =& $member_handler->getUser($uid);
    
// initialisation variables    
    
$message '';    
    
$phone '';    
    
$name_user '';    
    
$email_user ='';
    
$email_author $thisUser->getVar('email');
    
$title "Regarding your profile on FreelancerSupport.com";
    if(
$xoopsUser) {
        
$name_user = ($xoopsUser->getVar('name')!='')? $xoopsUser->getVar("name") : $xoopsUser->getVar("uname");
        
$email_user $xoopsUser->getVar("email""E");
    }

    include 
"include/form_contact.inc.php";
    
xoops_footer();
break;
}


$email_author is what we are looking for.

do you see any mistakes?
Mind anchors

8
trabis
Re: Your email visible in Profile module
  • 2009/1/4 21:05

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Must do 2 things.
First change ads_id= to uid= in the link, looks nicer!

Second, add this line in the form:
$form_contact->addElement(new XoopsFormHidden('uid', $uid));

This should be enough

9
deka87
Re: Your email visible in Profile module
  • 2009/1/5 7:26

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


cool, now it can send emails.

but what about hiding emails column in the profile/search.php? or maybe replacing those emails with the contact links like getVar('dirname')."/images/email.gif\" alt=\""._MD_CATADS_BYMAIL."\" />?
Mind anchors

10
deka87
Re: Your email visible in Profile module
  • 2009/1/5 9:39

  • deka87

  • Friend of XOOPS

  • Posts: 1125

  • Since: 2007/10/5


solved. here is the final result: http://freelancersupport.com/modules/profile/English-to-Russian-translators

so now nobody can see users' email address and the only way to contact them is via the website. privacy is ok now =)
Mind anchors

Login

Who's Online

365 user(s) are online (218 user(s) are browsing Support Forums)


Members: 0


Guests: 365


more...

Donat-O-Meter

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

Latest GitHub Commits