New signups as followers
Installation and Configuration
OK - Do this
Create a folder in the modules folder called 'jrAutoFollow'
In that folder create two files named 'config.php' and include.php'
In the config.php file enter this code -
<?php
/**
* @copyright 2012 Talldude Networks, LLC.
* @author Paul Asher <paul [at] jamroom [dot] net>
*/
// make sure we are not being called directly
defined('APP_DIR') or exit();
/**
* jrAutoFollow_config
*/
function jrAutoFollow_config(){
$_tmp = array(
'name' => 'followee',
'label' => 'Select Profile',
'type' => 'text',
'help' => 'Enter the ID of the profile that will be automatically followed upon signup',
'validate' => 'number_nz',
'default' => 1,
'required' => true
);
jrCore_register_setting('jrAutoFollow', $_tmp);
return true;
}
?>
In the include.php file enter this code -
<?php
/**
* @copyright 2012 Talldude Networks, LLC.
* @author Paul Asher <paul [at] jamroom [dot] net>
*/
// make sure we are not being called directly
defined('APP_DIR') or exit();
/**
* meta
*/
function jrAutoFollow_meta(){
$_tmp = array(
'name' => 'Auto Follow',
'url' => 'autofollow',
'version' => '1.0.0',
'developer' => 'The Jamroom Network, ©' . strftime('%Y'),
'description' => 'Automatically follow specified profiles upon signup',
'category' => 'profiles',
'license' => 'jcl'
);
return $_tmp;
}
/**
* init
*/
function jrAutoFollow_init(){
// Event Listener
jrCore_register_event_listener('jrUser', 'signup_activated', 'jrAutoFollow_signup_activated_listener');
return true;
}
//---------------------------------------------------------
// EVENT LISTENER
//---------------------------------------------------------
/**
* Listen for the 'signup_activated' event and add user as a follower
* @param $_data array incoming data array
* @param $_user array current user info
* @param $_conf array Global config
* @param $_args array additional info about the module
* @param $event string Event Trigger name
* @return array
*/
function jrAutoFollow_signup_activated_listener($_data, $_user, $_conf, $_args, $event)
{
$_tmp = array(
'follow_active' => 1,
'follow_profile_id' => $_conf['jrAutoFollow_followee']
);
$_core = array(
'_profile_id' => $_data['_profile_id'],
'_user_id' => $_data['_user_id']
);
jrCore_db_create_item('jrFollower', $_tmp, $_core);
return $_data;
}
Goto your ACP then in the Profiles section enable this new module.
In its config section enter the ID of the profile to be auto-followed.
Done