collapse collapse
* User Info
 
 
Welcome, Guest. Please login or register.
* Search

* Board Stats
  • stats Total Members: 989
  • stats Total Posts: 18366
  • stats Total Topics: 2501
  • stats Total Categories: 7
  • stats Total Boards: 35
  • stats Most Online: 1144

Author Topic: Updated Autoinv.php to allow for per user inviting  (Read 2860 times)

0 Members and 1 Guest are viewing this topic.

Offline Snarfblatt

  • BeBot User
  • **
  • Posts: 63
  • Karma: +0/-0
Updated Autoinv.php to allow for per user inviting
« on: August 28, 2006, 06:24:21 pm »
A few of my members requested the ability to turn on/off auto-inviting on an individual basis. So I added a "auto_invite" field to the members table and changed the following methods in Autoinv.php:

Code: [Select]
/*
Toggles autoinvite on/off
*/
function switchauto($name, $toggle)
{
if ($this -> bot -> admin -> in_group($name, "superadmin"))
{
$this -> bot -> db -> query("DELETE FROM settings WHERE setting = 'auto_invite'");
$toggle == strtolower($toggle);
$new = (($toggle == "on") ? 1 : 0);
$this -> bot -> db -> query("INSERT INTO settings (setting, value) VALUES ('auto_invite', $new)");

$this -> auto = $new;

return "Auto inviting has been <font color=#ffff00>" .
(($new == 1) ? "enabled" : "disabled") . "</font>.";
}
else
{
$new = (($toggle == "on") ? 1 : 0);
$this-> bot -> db -> query ("UPDATE members SET auto_invite = $new");

return "Auto inviting has been <font color=#ffff00>" .
(($new == 1) ? "enabled" : "disabled") . " for " . $name . "</font>.";
}
}



/*
This gets called if a buddy logs on/off
*/
function buddy($name, $msg)
{
$invite = 0;

$result = $this -> bot -> db -> select("SELECT auto_invite FROM members WHERE nickname = '$name'");
if (empty($result))
$invite = 0;
else
$invite = $result[0][0];

if (($invite == 1) && ($this -> auto == 1) && ($msg == 1) && ($this -> bot -> is_member($name) == 1))
$this -> bot -> aoc -> privategroup_invite($name);
}

Don't know if this is helpful to anyone, but I thought I would post it here.

Offline laen

  • BeBot User
  • **
  • Posts: 24
  • Karma: +0/-0
Re: Updated Autoinv.php to allow for per user inviting
« Reply #1 on: September 08, 2006, 03:57:20 am »
Little error in the code above, change it from..

Code: [Select]
else
{
$new = (($toggle == "on") ? 1 : 0);
$this-> bot -> db -> query ("UPDATE members SET auto_invite = $new");

..to..

Code: [Select]
else
{
$new = (($toggle == "on") ? 1 : 0);
$this-> bot -> db -> query ("UPDATE members SET auto_invite = $new WHERE nickname = '$name'");

in the switchauto function.

Offline Snarfblatt

  • BeBot User
  • **
  • Posts: 63
  • Karma: +0/-0
Re: Updated Autoinv.php to allow for per user inviting
« Reply #2 on: September 11, 2006, 05:40:09 pm »
Whoops.. that was a small mistake... :). That might explain a few problems I was having ;).

 

* Recent Posts
Com bot module by bitnykk
[November 25, 2024, 05:36:11 pm ]


0.8.x updates for AO by bitnykk
[June 23, 2024, 03:19:47 pm ]


0.8.x updates for AoC by bitnykk
[June 23, 2024, 03:19:44 pm ]


[AoC] special char for items module by bitnykk
[February 09, 2024, 09:41:18 pm ]


BeBot still alive & kicking ! by bitnykk
[December 17, 2023, 12:58:44 am ]

* Who's Online
  • Dot Guests: 340
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.
* Forum Staff
bitnykk admin bitnykk
Administrator
Khalem admin Khalem
Administrator
WeZoN gmod WeZoN
Global Moderator
SimplePortal 2.3.7 © 2008-2024, SimplePortal