PHP Classes

File: upload/plugins/bulletinboard/api_libs/bb_add_new_follower.php

Recommend this page to a friend!
  Classes of James Brows   PHP Bulletin Board   upload/plugins/bulletinboard/api_libs/bb_add_new_follower.php   Download  
File: upload/plugins/bulletinboard/api_libs/bb_add_new_follower.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Bulletin Board
Manage and post messages in multi-user forums
Author: By
Last change:
Date: 2 years ago
Size: 1,158 bytes
 

Contents

Class file image Download
<?php

function bb_add_new_follower()
{
    
  
$username=isset(Configs::$_['user_data']['user_id'])?Configs::$_['user_data']['user_id']:'';

  
$followed_id=addslashes(getPost('followed_id'));
  
$to_username=addslashes(getPost('to_username'));

   if(!isset(
$followed_id[2]))
   {
       return
'NG';
   }

   if(!isset(
$to_username[2]))
   {
       return
'NG';
   }

   
$insertData=array(
       
'follow_id'=>newID(22) ,
       
'user_id'=>Configs::$_['user_data']['user_id'],
       
'followed_user_id'=>addslashes(getPost('followed_id')),
    );


   
$queryStr=arrayToInsertStr('bb_user_follow_data',$insertData);
   
$db=new Database();

   
$db->nonquery("delete from bb_user_follow_data where user_id='".Configs::$_['user_data']['user_id']."' AND followed_user_id='".$insertData['followed_user_id']."'");
   
   
$db->nonquery($queryStr);

   
saveActivities('bb_follow_add','Following user '.$to_username,$username);

   
BB_User::updateFollowCountStats(Configs::$_['user_data']['user_id']);
   
BB_User::updateFollowCountStats($insertData['followed_user_id']);

// EmailSystem::prepare_send_newuser($insertData);

   
return 'OK';
}