1
wishcraft
@request -- User Signup Basic Sentry -- Avatar, Rego Date & Posts

The following is the basic outline for a sentry on signup to drop maligant signup bots form threading:-

The first file is the sentry preloader in system

/**
 * System Preloads
 *
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code
 * which is considered copyrighted (c) material of the original comment or credit authors.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright   The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license     GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
 * @author      Simon Roberts (AKA +61252661492)
 * @version     $Id: sentry.php 
 */

defined('XOOPS_ROOT_PATH') or die('Restricted access');

class 
SystemSentryPreload extends XoopsPreloadItem
{
    function 
eventCoreIncludeCommonEnd($args)
    {
                if (!
$GLOBALS['xoopsUserConfig']['sentry_enabled'])
                          return 
false;
        
$criteriaAvarta = new Criteria('user_avatar''%blank.gif%''LIKE');
        
$criteriaNewReg = new CriteriaCompo(new Criteria('user_regdate'time() - (24 3600 $GLOBALS['xoopsUserConfig']['sentry_regodays']), '<'));
        
$criteriaNewReg->add(new Criteria('last_login'time() - (24 3600 $GLOBALS['xoopsUserConfig']['sentry_loindays']), "<"), 'AND');
        
$criteriaNewReg->add(new Criteria('posts'$GLOBALS['xoopsUserConfig']['sentry_posts'], "<"), 'AND');
        
$criteria = new CriteriaCompo($criteriaAvarta);
        
$criteria->add($criteriaNewReg"AND");
        
$member_handler xoops_gethandler('member');
        
$tokill = array();
        foreach(
$member_handler->getUsers($criteriatrue) as $key => $user)
        {
            if (!
$user->isAdmin())
                
$tokill[$user->getVar("uid")] = $user;
        }
        if (
count($tokill))
        {
            
xoops_loadLanguage('user');
            
$xoopsMailer =& xoops_getMailer();
            
$xoopsMailer->useMail();
            
$xoopsMailer->setTemplate('sentrydropped.tpl');
            
$xoopsMailer->setSubject(sprintf("Your account on '%s' has been deleted by the sentry!"$GLOBALS['xoopsConfig']['sitename']));
            
$xoopsMailer->setToUsers($tokill);
            @
$xoopsMailer->send();
            
$sql = array();
            
$GLOBALS["xoopsDB"]->queryF($sql[] = "DELETE FROM `" $GLOBALS["xoopsDB"]->prefix('users') . "` WHERE `uid` IN(" implode(", "array_keys($tokill)) . ")");
            
$GLOBALS["xoopsDB"]->queryF($sql[] = "DELETE FROM `" $GLOBALS["xoopsDB"]->prefix('groups_users_link') . "` WHERE `uid` IN(" implode(", "array_keys($tokill)) . ")");

        }
      }
}
?>


You will have to create the following variable I suggest they are made as a single item drop down options list, variable from 2 weeks down to 3 days for the first avriable, then something that is from 24 month down to 1 month an then 2 - 20 items for the number of posts, you will see these variables that will have to be created specified in the function above with the $GLOBALS['xoopsUserConfig'] variable, these go in the User Preferences in the system module, default is this option is turned off.

You will also have to add a template to language/english/mail_template/sentrydropped.tpl, an example of this would be:-
To {X_UNAME},

Your account on "{SITENAME}" has been removed due to the User Sentry finding that you have
either not changed your avatar
, or you where in active without enough posts and also not
changing your avatar
!

- as 
you didn't change your 'avatar' from the blank default image; 
  with 7 - 14 days in consecutive selection, your account has been removed 
  off the systems' 
and terminated!!

Many thanks,

{
SITE_COMPANY}
{
SITE_URL}


You will probably also want to have a register_sentry.tpl like so which you will have to alter the class/??.php too enable this if the sentry is turn on, it will need the number of days passed to the emailer so it can be populated as ie. {X_SENTRYDAYS}.

Hello {X_UNAME},

Thank you for registering as a member of {SITENAME}. As a registered member your can:
Send private messages among members
Participate in discussion boards
Get the latest news
Submit content
Muchmuch more....

The email address ({X_UEMAIL}) has been used to create a user profile for you.

NOTICE:-

 - 
You will have to change your avatar within {X_SENTRYDAYSdays cause if you haven't somewhere 
   between these times you will be deleted if your avatar remains on the default blank
   as well as remain inactive for a period of 24 Months!

To become a member of {SITENAME}, please confirm your
request by clicking on the link below:

{X_UACTLINK}

-----------
Best Regards
{SITENAME}
({SITEURL}) 
{ADMINMAIL}

Login

Who's Online

189 user(s) are online (34 user(s) are browsing Support Forums)


Members: 0


Guests: 189


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