Topic: Submit User Data To Stopforumspam (in progress)
Hey anyone, could just use a bit of help with the adding of api key
This is what I've got till now:
Installing the stopforumspam API key field into config
[code=xml]
<install>
<![CDATA[
if (defined('EXT_CUR_VERSION'))
{
// you can make special update code for each previous extension version
}
else
{ // it's a fresh install
$forum_db->query('INSERT INTO '.$forum_db->prefix.'config VALUES (\'stopforumspam_apikey\', \'\')') or error(__FILE__, __LINE__);
}
]]>
</install>
[/code]
uninstalling of the stopforumspam API key
[code=xml]
<uninstall>
<![CDATA[
$sql = array(
'DELETE' => 'config',
'WHERE' => 'conf_name IN (\'stopforumspam_apikey\')'
);
$forum_db->query_build($sql) or error(__FILE__, __LINE__);
]]>
</uninstall>
[/code]
add a field to administration where APIkey can be entered - aop_features_general_fieldset_end
[code=xml]
<hook id="aop_features_general_fieldset_end">
<![CDATA[
if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'.php')){
include $ext_info['path'].'/lang/'.$forum_user['language'].'.php';
}else{
include $ext_info['path'].'/lang/English.php';
}
?>
<div class="content-head">
<h2 class="hn"><span>Stopforumspam</span></h2>
</div>
<fieldset class="sf-set group-item<?php echo ++$forum_page['group_count'] ?>">
<legend><span>Stopforumspam:</span></legend>
<div class="sf-box text">
<label for="fld<?php echo ++$forum_page['fld_count'] ?>"><span><?php echo $lang_recaptcha['public_key'];?></span></label>
<span class="fld-input"><input size="25" type="text" id="fld<?php echo $forum_page['fld_count'] ?>" name="form[stopforumspam_apikey]" value="<?php echo $forum_config['stopforumspam_apikey'];?>" /></span>
</div>
</fieldset>
<?php
]]>
</hook>
[/code]
add to administration - aop_features_validation
[code=xml]
<hook id="aop_features_validation">
<![CDATA[
if (!isset($form['stopforumspam_apikey']) || empty($form['stopforumspam_apikey']))
$form['stopforumspam_apikey'] = '';
]]>
</hook>
[/code]
Add to admin section - aop_pre_update_configuration
[code=xml]
<hook id="aop_pre_update_configuration">
<![CDATA[
if (isset($form['stopforumspam_apikey']))
{
if ($form['stopforumspam_apikey'] != $forum_config['stopforumspam_apikey'])
$forum_db->query('UPDATE '.$forum_db->prefix.'config SET conf_value = \''.$forum_db->escape($form['stopforumspam_apikey']).'\' WHERE conf_name = \'stopforumspam_apikey\'', true) or error(__FILE__, __LINE__);
}
]]>
</hook>
[/code]
=================================
todo:
add button in User management between Ban User & Delete user: Delete & Report To SFS
add option in profile.php
so in admin/user.php lines 343-358
[code=php]
// Setup control buttons
$forum_page['mod_options'] = array();
if ($forum_page['num_users'] > 0)
{
if ($forum_user['g_id'] == FORUM_ADMIN || ($forum_user['g_moderator'] == '1' && $forum_user['g_mod_ban_users'] == '1'))
$forum_page['mod_options']['ban'] = '<span class="submit'.((empty($forum_page['mod_options'])) ? ' first-item' : '').'"><input type="submit" name="ban_users" value="'.$lang_admin_users['Ban'].'" /></span>';
if ($forum_user['g_id'] == FORUM_ADMIN)
{
$forum_page['mod_options']['delete'] = '<span class="submit'.((empty($forum_page['mod_options'])) ? ' first-item' : '').'"><input type="submit" name="delete_users" value="'.$lang_admin_common['Delete'].'" /></span>';
$forum_page['mod_options']['change_group'] = '<span class="submit'.((empty($forum_page['mod_options'])) ? ' first-item' : '').'"><input type="submit" name="change_group" value="'.$lang_admin_users['Change group'].'" /></span>';
}
}
($hook = get_hook('aus_show_users_pre_moderation_buttons')) ? eval($hook) : null;
[/code]
profile.php lines 2512-2523
[code=php]
// Setup ban and delete options
$forum_page['user_management'] = array();
if ($forum_user['g_moderator'] == '1')
$forum_page['user_management']['ban'] = '<div class="ct-set set'.++$forum_page['item_count'].'">'."\n\t\t\t\t".'<div class="ct-box">'."\n\t\t\t\t\t".'<h3 class="ct-legend hn">'.$lang_profile['Ban user'].'</h3>'."\n\t\t\t\t".'<p><a href="'.forum_link($forum_url['admin_bans']).'?add_ban='.$id.'">'.$lang_profile['Ban user info'].'</a></p>'."\n\t\t\t\t".'</div>'."\n\t\t\t".'</div>';
else if ($forum_user['g_moderator'] != '1' && $user['g_id'] != FORUM_ADMIN )
{
$forum_page['user_management']['ban'] = '<div class="ct-set set'.++$forum_page['item_count'].'">'."\n\t\t\t\t".'<div class="ct-box">'."\n\t\t\t\t\t".'<h3 class="ct-legend hn">'.$lang_profile['Ban user'].'</h3>'."\n\t\t\t\t".'<p><a href="'.forum_link($forum_url['admin_bans']).'?add_ban='.$id.'">'.$lang_profile['Ban user info'].'</a></p>'."\n\t\t\t\t".'</div>'."\n\t\t\t".'</div>';
$forum_page['user_management']['delete'] = '<div class="ct-set set'.++$forum_page['item_count'].'">'."\n\t\t\t\t".'<div class="ct-box">'."\n\t\t\t\t\t".'<h3 class="ct-legend hn">'.$lang_profile['Delete user'].'</h3>'."\n\t\t\t\t".'<p><a href="'.forum_link($forum_url['delete_user'], $id).'">'.$lang_profile['Delete user info'].'</a></p>'."\n\t\t\t\t".'</div>'."\n\t\t\t".'</div>';
}
($hook = get_hook('pf_change_details_admin_pre_header_load')) ? eval($hook) : null;
[/code]