xoops forums


Module Developer
Posted on: 2015/6/25 3:12
wishcraft (Show more)
Module Developer
Posts: 3711
Since: 2007/5/18

@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
 * @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');

SystemSentryPreload extends XoopsPreloadItem
                if (!
$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);
$member_handler xoops_gethandler('member');
$tokill = array();
$member_handler->getUsers($criteriatrue) as $key => $user)
            if (!
$tokill[$user->getVar("uid")] = $user;
        if (
$xoopsMailer =& xoops_getMailer();
$xoopsMailer->setSubject(sprintf("Your account on '%s' has been deleted by the sentry!"$GLOBALS['xoopsConfig']['sitename']));
$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:-

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,


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.


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:


Best Regards