PDA

View Full Version : Anyone underway with HiveMail?


Briskoda
08-10-2004, 02:14 PM
Anybody using or enteraining a module for hivemail?

Have some ideas but a bit away from sitting down and making any code.

Zachery
08-10-2004, 08:38 PM
If i had a copy or brian did (iirc he does not) one of us could work somthing out :)

Our Sponsors
 

Brian
08-11-2004, 12:37 AM
Actually I do have one (had to buy it durning their April sale last year when it was about $25 a while ago ;)). I'll try to look into it when I get the time.

Briskoda
08-13-2004, 07:39 AM
Darn it 25usd you say..oh well, one less beer for me now.

Integration is not that hard...

Used there 3.0.3 code into a php, edited it alot to suit and created a new template, seems to work. I'll release and tidy up when I'm all done in case it changes alot.

Our Sponsors
 

ixian
08-15-2004, 10:04 PM
Did you get this completed? I'd love to see it, would be very helpful.

Briskoda
08-18-2004, 07:16 PM
Hi,

Sorry have been away with work...

Rough shot attached of it as a central module..sorry so much is blanked out, never know who is watching and it's better to see it inside than on it's own.

Briskoda
08-18-2004, 07:25 PM
The template is adv_portal_mail

This is all very rough still, but basically define a module and a few templates. Use the vb 3.0.3 integration as a guide for the templates.

Php code below again it might not be 100% as it's not fully tested.


The template is a simple if test on a new var signup, if not set then it displays the signup form. I have hard set the username to make it easier to track. There are some issues, such as sceret question and answer settings. So it needs some tweaking, but at a basic level it is thus:

<if condition="$signup == 1">
<form action="" method="post">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="hive_signup" value="1" />
<input type="hidden" name="do" value="addmail" />

<table cellpadding="$stylevar[outerborderwidth]" cellspacing="0" border="0" class="tborder" width="$stylevar[tablewidth]" align="center"><tr><td>
<table cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
<tr>
<td class="tcat" colspan="2"><span class="smallfont" style="float:$stylevar[left]"><strong>Your E-Mail</strong></td></tr>

<tr><td class="panelsurround" align="center"><div class="panel">Sign Up for Email</b></td>
</tr>
<tr>
<td class="alt2"><b>Account name:</b></td>
</tr>
<tr><td class="alt1"><input type="hidden" name="hive_username" value="$bbuserinfo[username]"/>$bbuserinfo[username]
<select name="hive_userdomain">$hive_domainname_options</select></td>
</tr>
<tr><td class="alt2"><b>Password:</b></td></tr>

<tr><td class="alt2"><input type="password" class="bginput" size="25" name="password" /></td></tr>
<tr><td class="alt1">Some Terms of Use.</td></tr>
<tr><td class="alt1" align=center><input type="submit" class="button" value="Submit Now" /></td></tr>

</table>
</td></tr></table>



</form>
<else />


<table cellpadding="$stylevar[outerborderwidth]" cellspacing="0" border="0" class="tborder" width="$stylevar[tablewidth]" align="center"><tr><td>

<table cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
<tr>
<td class="tcat" colspan="2"><span class="smallfont" style="float:$stylevar[left]"><strong>Your E-Mail</strong></td></tr>

<tr><td class="panelsurround" align="center"><div class="panel">

<table width=90%>
<tr><td>Mail Information</b></td>
</tr>


<tr><td>

<!-- HIVEMAIL ADD -->
<if condition="$show['hive_newemails']">
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<thead>
<tr>
<td class="thead" colspan="7">
<a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('usercp_submails')"><img id="collapseimg_usercp_submails" src="$stylevar[imgdir_button]/collapse_tcat$vbcollapse[collapseimg_usercp_submails].gif" alt="" border="0" /></a>
<a href="$bburl/mail">Unread Email</a><span class="normal">: ($nummails)</span>
</td>
</tr>
</thead>
<tbody id="collapseobj_usercp_submails" style="$vbcollapse[collapseobj_usercp_submails]">
<if condition="$show['hive_newdetails']">
<tr class="thead">
<td class="thead" nowrap="nowrap">Mail From</td>
<td class="thead" nowrap="nowrap">$vbphrase[subject]</td>
<td class="thead" nowrap="nowrap">Date Recieved</td>
</tr>
$mailbits
<else />
<tr>
<td class="alt1" align="center" colspan="7"><strong>No Unread Mail</strong></td>
</tr>
</if>
<tr>
<td align="$stylevar[right]" colspan="7" class="tfoot">
<span class="smallfont"><a href="$bburl/mail">Goto your Mail Account</a></span>
</td>
</tr>
</tbody>
</table>

</if>
<!-- END HIVEMAIL ADD -->
</td></tr>
</table>
</div>

</td></tr></table></td></tr></table>

</if>


globalize($_POST, array(
'do' => STR,
'hive_signup' => STR,
'hive_username' => STR,
'hive_userdomain' => STR
));
$signup=null; //Assume false.
//BRISKODA Start
// @@@@@@@@@@
// <hivemail>
$hivemail_filepath = '<Your Path>';
if($_REQUEST['do'] == null)
{
$_REQUEST['do'] = 'signup';
}

define('VB_PLUGIN', true);
require($hivemail_filepath.'/includes/vbulletin_plugin.php');

if (($_REQUEST['do'] == 'signup' or $_REQUEST['do'] == 'register') and
$bbuserinfo['userid'] != 0 and
!$vboptions['allowmultiregs'] and
($bbuserinfo['hiveuserid'] == 0 or
!$hiveuser = $DB_Hive->query_first("
SELECT userid FROM hive_user
WHERE userid = $bbuserinfo[hiveuserid]
"))) {
//header('Location: ./&do=mailsignup');
//exit;
//Save a redirect.
//Will cause template to display account create form.
$signup=1;
//exit;

}
else {if ($_POST['do'] == 'addmail') {
if ($bbuserinfo['userid'] != 0) {
$_REQUEST['do'] = 'register';
//define('VB_PLUGIN', true);
//require($hivemail_filepath.'/includes/vbulletin_plugin.php');
if ($bbuserinfo['hiveuserid'] != 0 and
$hiveuser = $DB_Hive->query_first("
SELECT userid FROM hive_user
WHERE userid = $bbuserinfo[hiveuserid]
")) {
header('Location: $bburl/forums/usercp.php');
}
$_POST['email'] = $bbuserinfo['email'];
$birthday = $bbuserinfo['birthday'];
$_POST['timezoneoffset'] = $bbuserinfo['timezoneoffset'];
hivemail_register_user_3($bbuserinfo['userid'], $_POST['password'], false);
$url = '<your members area the screenshot in my case>';
eval(print_standard_redirect('redirect_hivemail_thankyou'));
//exit; //exit breaks cmps.
} else {
//$_REQUEST['do'] = 'signup';
}
}

}

// HIVEMAIL ADD
// ############################### start new mails ###############################
$show['hive_newemails'] = false;
if ($bbuserinfo['hiveuserid'] != 0) {
$show['hive_newemails'] = true;
//define('FORUM_PLUGIN', true);
//require_once($vboptions['hive_filepath'].'/includes/vbulletin_plugin.php');

$unreadmails = $DB_Hive->query("
SELECT *
FROM hive_message
WHERE userid = $bbuserinfo[hiveuserid]
AND NOT(status & ".MAIL_READ.")
");

$mailbits = '';
$nummails = $DB_Hive->num_rows($unreadmails);
if ($nummails > 0)
{
$show['hive_newdetails'] = true;
while ($unread = $DB_Hive->fetch_array($unreadmails)) {
$unread['from'] = iif(empty($unread['name']), $unread['email'], $unread['name'].' <'.$unread['email'].'>');
$unread['dateline'] = date($vboptions['dateformat'].' '.$vboptions['timeformat'], $unread['dateline']);
eval('$mailbits .= "' . fetch_template('<Add an unread template repeater>') . '";');
}
}
else
{
$show['hive_newdetails'] = false;
}
}
// END HIVEMAIL ADD


eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('<your Template>') . '";');

Thats it at the moment. Uploadthat and create a module around it. I have limited my modules hence I'm not to fussed about user id tracking as I know they will have one when they can see the signup page.

ricoche
08-21-2004, 01:31 AM
Hi there,

This is a nice start. I've been working with it, but I haven't been able to get past this php error.

Fatal error: Cannot redeclare microdiff() (previously declared in /home/username/public_html/hivemail/includes/db_mysql.php:25) in /home/username/public_html/hivemail/includes/db_mysql.php on line 25

Any ideas?

Actually, I just did a refresh on my browser and now get the following error:

Fatal error: Call to a member function on a non-object in /home/username/public_html/forums/modules/hivemail.php on line 32

I can see this is perhaps way over my head. Perhaps it is best I wait for a module release of this in the future. ;)

Thanks very much!

Briskoda
08-23-2004, 11:29 AM
Hi,

*I must turn email notification on*

Two things spring to mind here.

First message, looks familiar :D The hive base code uses a three step approach to get you to the login process. I got this when the the plugin define was called twice. The above snippet has that second define commented out. Since I bypass the Hive steps and go direct to check or get unreads the example code from Hive is no longer valid for my needs. Using the code above which is just trimmed down from Hive's examples it should work. But bear in mind I use CMPS authentication to block people from this page it might need tweaking if it were required to be public. That said it might not, just stop guests, sorry wandering off the topic.

Second Message, depends what you have in your file on line 32...if you want mail me the php file, but rename it to a .txt so it's not bounced.

I'll happily bundle this up to a module when I am sure it's all working.

ricoche
08-24-2004, 08:28 AM
Thank you very much. I'll take a look at your notes and send you the file.

:)