Alright gang, here it is!
Follow these simple steps, and you'll
have the ability to resend confirmation/activation URLs to unconfirmed users through AJAX!
Tested/Confirmed using Joomla 1.0.7 to 1.0.11 and CB 1.0 stable to 1.0.1
...thanks to skunk for providing a link to pre-modded CB files on page 6!
components/com_comprofiler/plugin/language/default_language/default_language.php (line 140) define display variables:
[code:1]
DEFINE('_UE_REG_CONFIRM_RESEND_SUB','Resend Activation URL Email Subject');
DEFINE('_UE_REG_CONFIRM_RESEND_DESC','Resend Activation URL Email Subject');
DEFINE('_UE_REG_CONFIRM_RESEND_MSG','Resend Activation URL Email');
[/code:1]
administrator/components/com_comprofiler/admin.comprofiler.html.php (line 1865) add HTML:
[code:1]
<tr align="center" valign="middle">
<td align="left" valign="top"><?php echo _UE_REG_CONFIRM_RESEND_SUB ?></td>
<td align="left" valign="top"><input type="text" name="cfg_reg_confirm_resend_sub" value="<?php echo stripslashes($ueConfig); ?>" /></td>
<td align="left" valign="top"><?php echo _UE_REG_CONFIRM_RESEND_DESC ?></td>
</tr>
<tr align="center" valign="middle">
<td align="left" valign="top"><?php echo _UE_REG_CONFIRM_RESEND_MSG ?></td>
<td align="left" valign="top" colspan=2><textarea name="cfg_reg_confirm_resend_msg" cols=50 rows=6><?php echo stripslashes($ueConfig); ?></textarea></td>
</tr>
[/code:1]
administrator/components/com_comprofiler/admin.comprofiler.php (line 326) add JavaScript case statement:
[code:1]
case 'resendActivation':
resendActivation();
break;
[/code:1]
administrator/components/com_comprofiler/admin.comprofiler.php (line 44) add the following:
[code:1]
$rid = trim( mosGetParam( $_REQUEST, 'rid', null ) );
[/code:1]
administrator/components/com_comprofiler/admin.comprofiler.php (line 2634) add PHP function:
[code:1]
// Ajax: administrator/index3.php?option=com_comprofiler&task=resendActivation&no_html=1&rid=X :
function resendActivation(){
global $database, $mosConfig_absolute_path, $mosConfig_live_site, $ueConfig, $rid;
$i=0;
if( !empty( $rid ) )
{
$row_ids = explode(",",$rid);
foreach( $row_ids as $row_id )
{
if( !empty( $row_id ) )
{
$query = "SELECT * FROM #__comprofiler c, #__users u WHERE c.id=u.id AND c.id =" . $row_id;
$database->setQuery($query);
$user = $database->loadObjectList();
$cbNotification = new cbNotification();
$cbNotification->sendFromSystem($user[0],getLangDefinition($ueConfig),getLangDefinition($ueConfig)) || die('error');
$i++;
}
}
}
else echo 'Nothing to process.';
echo ($i>0)?($i>1)?$i.' sent!':'sent!':'';
}
[/code:1]
administrator/components/com_comprofiler/admin.comprofiler.html.php (line 1450) change this line to and add the following:
[code:1]
global $mosConfig_offset, $ueConfig;
if( $ueConfig == "1" )
{
?>
<script type="text/javascript"><!--//--><![CDATA[//><!--
function makeRequest(url,id) {
var http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
// See note below about this line
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
// alert('Giving up: Cannot create an XMLHTTP instance');
return false;
}
http_request.onreadystatechange = function() { alertContents(http_request,id); };
http_request.open('GET', url, true);
http_request.send(null);
}
function alertContents(http_request,id) {
if (http_request.readyState == 4) {
if ((http_request.status == 200) && (http_request.responseText.length < 1025)) {
document.getElementById(id).innerHTML = http_request.responseText;
} else {
document.getElementById(id).innerHTML = 'There was a problem with the request.';
}
}
}
function cbResendConfirmURL(id,rid) {
document.getElementById(id).innerHTML = '<font color="#cccccc">hold...</font>';
makeRequest('index3.php?option=com_comprofiler&task=resendActivation&no_html=1&rid='
+rid,id);
return false;
}
function cbAddEvent(obj, evType, fn){
if (obj.addEventListener){
obj.addEventListener(evType, fn, true);
return true;
} else if (obj.attachEvent){
var r = obj.attachEvent("on"+evType, fn);
return r;
} else {
return false;
}
}
//--><!]]></script>
<? }
[/code:1]
(NOTICE: You may need to add an ending
?> tag at the end to complete the php statement, this is only if the
NEXT line begins with
<?php (or you could optionally just remove the opening
<?php tag!)
administrator/components/com_comprofiler/admin.comprofiler.html.php (line 1522) add the following BEFORE '</td>':
[code:1]
<?php if( !$row->confirmed and $ueConfig == "1" ){ ?>
<span id="cbResendActivation<?php echo $row->id; ?>"><a href="#resend_now" onclick="return cbResendConfirmURL(this.parentNode.id,<?php echo $row->id; ?> );" title="Resend Activation URL Now!">resend</a></span>
<?php } ?>
[/code:1]
Final step:
- Log into Joomla Admin
- Browse to Community Builder Configuration
- Click on the Registration tab
- Enter text for Resend Activation URL Email Subject and Resend Activation URL Email. NOTE: You may want to simply copy your email/subject from Pending Approval Email
You're all set
Easter Egg:
To resend Activation URLs to MULTIPLE individuals, there is a method for performing this task!
Currently, there is not a friendly interface to do so, but it can be done!
First, identify those users who have not been Confirmed.
Personally, I would use SQL for this step.
This will give you the row ID of all unconfirmed users.
[code:1]
select
cb.id
from
jos_comprofiler cb,
jos_users usr
where
cb.confirmed <> 1
and usr.id=cb.id
[/code:1]
Then, you simply take this list and delimit by comma, passing in as
&rid= to the following link.
Here's an example (You must be logged in as administrator First, then manually browse to the URL)
[code:1]
http://www.your-site-here-.com/administrator/index3.php?option=com_comprofiler&task=resendActivation&no_html=1&rid=1,10,55,200
[/code:1]
Post edited by: moneybagsxp, at: 2006/11/03 19:43