Can ecards be sent using bridged phpbb memberlist emails Can ecards be sent using bridged phpbb memberlist emails
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Can ecards be sent using bridged phpbb memberlist emails

Started by janebond, December 07, 2006, 01:12:38 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

janebond

I am running cpg1.4.10 bridged with phpbb 2.0.21.  Does there already exist a method to use a pull down list of my phpbb members on the ecard form?  Basically, it is to allow members to send one another ecards without knowing one another's email address.  , similar to the way they can send email on the forum?

I'm willing to attempt some coding but my concern is that the phpbb script which connects member names to emails probably will not operate outside of the phpbb environment.  I know cpg does not have its own email function, but is there a way to link it to phpbb's email function?

I understand a lot of people will not have a use for such a feature, but I'd like to make it easy for my forum members to send holiday cards.

I've read through the documentation, searched the board, and looked at some of the code I thought might be relevant.

Nibbler

ecard.php

find


$recipient_name = get_post_var('recipient_name');
$recipient_email = get_post_var('recipient_email');


change to


//$recipient_name = get_post_var('recipient_name');
//$recipient_email = get_post_var('recipient_email');



if (!empty($_POST['recipient_id'])){

$recipient_id = (int) $_POST['recipient_id'];

$sql = "SELECT {$cpg_udb->field['username']} AS user_name,
{$cpg_udb->field['email']} AS user_email
FROM  {$cpg_udb->usertable}
WHERE {$cpg_udb->field['user_id']} = $recipient_id
LIMIT 1";

$result = cpg_db_query($sql, $cpg_udb->link_id);

if (!mysql_num_rows($result)) cpg_die(ERROR, 'Unable to obtain user details', __FILE__, __LINE__);

$row = mysql_fetch_assoc($result);
$recipient_name = stripslashes($row['user_name']);
$recipient_email = $row['user_email'];

}


and then find


        <tr>
                <td class="tableh2" colspan="2"><b>{$lang_ecard_php['to']}</b></td>
        </tr>
        <tr>
                <td class="tableb" valign="top" width="40%">
                        {$lang_ecard_php['rcpt_name']}<br />
                </td>
                <td valign="top" class="tableb" width="60%">
                        <input type="text" class="textinput" name="recipient_name"  value="$recipient_name" style="width: 100%;" /><br />
                </td>
        </tr>
        <tr>
                <td class="tableb" valign="top" width="40%">
                        {$lang_ecard_php['rcpt_email']}<br />
                </td>
                <td valign="top" class="tableb" width="60%">
                        <input type="text" class="textinput" name="recipient_email"  value="$recipient_email" style="width: 100%;" /><br />
                        $recipient_email_warning
                </td>
        </tr>


change to


        <tr>
                <td class="tableh2" colspan="2"><b>{$lang_ecard_php['to']}</b></td>
        </tr>
       
EOT;

$recipientdropdown = '<select name="recipient_id">';

$sql = "SELECT {$cpg_udb->field['user_id']} AS user_id,
{$cpg_udb->field['username']} AS user_name
FROM  {$cpg_udb->usertable}
WHERE {$cpg_udb->field['email']} != ''
ORDER BY {$cpg_udb->field['username']}";

$result = cpg_db_query($sql, $cpg_udb->link_id);

while ($row = mysql_fetch_assoc($result))
$recipientdropdown .= '<option value="'. $row['user_id'] . '">'.stripslashes($row['user_name']).'</option>';

$recipientdropdown .= '</select>';

echo <<< EOT
        <tr>
                <td class="tableb" valign="top" width="40%">
                        Recipient<br />
                </td>
                <td valign="top" class="tableb" width="60%">
                        $recipientdropdown<br />
                </td>
        </tr>


If you want to hide the email of the sender then I think I already posted how to do that before.

janebond

Many many thanks for that. I just gave it a quick test and it works like a charm.  That was quick and right on point, I can't thank you enough.

I'd like to test myself and see if I can adapt it so that users have a choice of sending to another forum member or to a known email address,but as is, your code Nibbler was just what I needed.

Gephri

Nibbler - can you provide coding to allow user to send an ecard to a phpbb member OR by typing in a regular email address.  Some members want to send inside the bb and others want to send to non-members outside.
Thanks in advance.