ocPortal Developer's Guide: OCF groups
» Return to Contents
sources/ocf_groups.php
Global_functions_ocf_groups.php
void init__ocf_groups()
Standard code module initialisation function.
Parameters…
(No return value)
function init__ocf_groups()
{
global $USER_GROUPS_CACHED;
$USER_GROUPS_CACHED=array();
global $GROUP_MEMBERS_CACHE;
$GROUP_MEMBERS_CACHE=array();
global $PROBATION_GROUP;
$PROBATION_GROUP=NULL;
global $ALL_DEFAULT_GROUPS;
$ALL_DEFAULT_GROUPS=array();
}
tempcode ocf_nice_get_usergroups(?AUTO_LINK it)
Get a nice list for selection from the usergroups.
Parameters…
| Name |
it |
| Description |
Usergroup selected by default (NULL: no specific default). |
| Default value |
|
| Type |
?AUTO_LINK |
Returns…
| Description |
The list. |
| Type |
tempcode |
function ocf_nice_get_usergroups($it=NULL)
{
$group_count=$GLOBALS['FORUM_DB']->query_value('f_groups','COUNT(*)');
$_m=$GLOBALS['FORUM_DB']->query_select('f_groups',array('id','g_name'),($group_count>200)?array('g_is_private_club'=>0):NULL);
$entries=new ocp_tempcode();
foreach ($_m as $m)
{
$entries->attach(form_input_list_entry(strval($m['id']),$it===$m['id'],get_translated_text($m['g_name'],$GLOBALS['FORUM_DB'])));
}
return $entries;
}
GROUP get_first_default_group()
Find the first default group.
Parameters…
Returns…
| Description |
The first default group. |
| Type |
GROUP |
function get_first_default_group()
{
$default_groups=ocf_get_all_default_groups(true);
return array_pop($default_groups);
}
array ocf_get_all_default_groups(boolean include_primary)
Get a list of the default usergroups (the usergroups a member is put in when they join).
Parameters…
| Name |
include_primary |
| Description |
Whether to include the default primary. |
| Default value |
boolean-false |
| Type |
boolean |
Returns…
| Description |
The list of default IDs. |
| Type |
array |
function ocf_get_all_default_groups($include_primary=false)
{
global $ALL_DEFAULT_GROUPS;
if (array_key_exists($include_primary?1:0,$ALL_DEFAULT_GROUPS)) return $ALL_DEFAULT_GROUPS[$include_primary?1:0];
$rows=$GLOBALS['FORUM_DB']->query_select('f_groups',array('id'),array('g_is_default'=>1,'g_is_presented_at_install'=>0),'ORDER BY g_order');
$groups=collapse_1d_complexity('id',$rows);
if ($include_primary)
{
$test=$GLOBALS['FORUM_DB']->query_value_null_ok('f_groups','id',array('id'=>db_get_first_id()+8));
if (!is_null($test))
$groups[]=db_get_first_id()+8;
}
$ALL_DEFAULT_GROUPS[$include_primary?1:0]=$groups;
return $groups;
}
void ocf_ensure_groups_cached(mixed groups)
Ensure a list of usergroups are cached in memory.
Parameters…
| Name |
groups |
| Description |
The list of usergroups (array) or '*'. |
| Type |
mixed |
(No return value)
function ocf_ensure_groups_cached($groups)
{
global $USER_GROUPS_CACHED;
if ($groups==='*')
{
$group_count=$GLOBALS['FORUM_DB']->query_value('f_groups','COUNT(*)');
$rows=$GLOBALS['FORUM_DB']->query_select('f_groups',array('*'),($group_count>200)?array('g_is_private_club'=>0):NULL);
foreach ($rows as $row)
{
$row['g__name']=get_translated_text($row['g_name'],$GLOBALS['FORUM_DB']);
$row['g__title']=get_translated_text($row['g_title'],$GLOBALS['FORUM_DB']);
$USER_GROUPS_CACHED[$row['id']]=$row;
}
return;
}
$groups_to_load='';
$counter=0;
foreach ($groups as $group)
{
if (!array_key_exists($group,$USER_GROUPS_CACHED))
{
if ($groups_to_load!='') $groups_to_load.=' OR ';
$groups_to_load.='g.id='.strval($group);
$counter++;
}
}
if ($counter==0) return;
$extra_groups=$GLOBALS['FORUM_DB']->query('SELECT g.* FROM '.$GLOBALS['FORUM_DB']->get_table_prefix().'f_groups g WHERE '.$groups_to_load,NULL,NULL,false,false,array('g_name','g_title'));
if (count($extra_groups)!=$counter) warn_exit(do_lang_tempcode('MISSING_RESOURCE'));
//require_code('lang');
foreach ($extra_groups as $extra_group)
{
if (function_exists('get_translated_text'))
{
$extra_group['g__name']=get_translated_text($extra_group['g_name'],$GLOBALS['FORUM_DB']);
$extra_group['g__title']=get_translated_text($extra_group['g_title'],$GLOBALS['FORUM_DB']);
}
$USER_GROUPS_CACHED[$extra_group['id']]=$extra_group;
}
}
tempcode ocf_get_group_link(GROUP id)
Get a rendered link to a usergroup.
Parameters…
| Name |
id |
| Description |
The ID of the group. |
| Type |
GROUP |
Returns…
| Description |
The link. |
| Type |
tempcode |
function ocf_get_group_link($id)
{
$_row=$GLOBALS['FORUM_DB']->query_select('f_groups',array('*'),array('id'=>$id),'',1);
if (!array_key_exists(0,$_row)) return make_string_tempcode(do_lang('UNKNOWN'));
$row=$_row[0];
if ($row['id']==db_get_first_id()) return make_string_tempcode(escape_html(get_translated_text($row['g_name'],$GLOBALS['FORUM_DB'])));
$name=ocf_get_group_name($row['id']);
$see_hidden=has_specific_permission(get_member(),'see_hidden_groups');
if ((!$see_hidden) && ($row['g_hidden']==1))
{
return make_string_tempcode(escape_html($name));
}
return hyperlink(build_url(array('page'=>'groups','type'=>'view','id'=>$row['id']),get_module_zone('groups')),$name,false,true);
}
string ocf_get_group_name(GROUP group)
Get a usergroup name.
Parameters…
| Name |
group |
| Description |
The ID of the group. |
| Type |
GROUP |
Returns…
| Description |
The usergroup name. |
| Type |
string |
function ocf_get_group_name($group)
{
$name=ocf_get_group_property($group,'name');
if (is_string($name)) return $name;
return get_translated_text($name,$GLOBALS['FORUM_DB']);
}
mixed ocf_get_group_property(GROUP group, ID_TEXT property)
Get a certain property of a certain.
Parameters…
| Name |
group |
| Description |
The ID of the group. |
| Type |
GROUP |
| Name |
property |
| Description |
The identifier of the property. |
| Type |
ID_TEXT |
Returns…
| Description |
The property value. |
| Type |
mixed |
function ocf_get_group_property($group,$property)
{
ocf_ensure_groups_cached(array($group));
global $USER_GROUPS_CACHED;
if (($property=='name') && ($USER_GROUPS_CACHED[$group]['g_hidden']==1) && (!has_specific_permission(get_member(),'see_hidden_groups')))
{
return do_lang('UNKNOWN');
}
return $USER_GROUPS_CACHED[$group]['g_'.$property];
}
mixed ocf_get_member_best_group_property(MEMBER member_id, ID_TEXT property)
Get the best value of all values of a property for a member (due to members being in multiple usergroups).
Parameters…
| Name |
member_id |
| Description |
The ID of the member. |
| Type |
MEMBER |
| Name |
property |
| Description |
The identifier of the property. |
| Type |
ID_TEXT |
Returns…
| Description |
The property value. |
| Type |
mixed |
function ocf_get_member_best_group_property($member_id,$property)
{
return ocf_get_best_group_property($GLOBALS['OCF_DRIVER']->get_members_groups($member_id,false,true),$property);
}
mixed ocf_get_best_group_property(array groups, ID_TEXT property)
Get the best value of all values of a property for a list of usergroups.
Parameters…
| Name |
groups |
| Description |
The list of usergroups. |
| Type |
array |
| Name |
property |
| Description |
The identifier of the property. |
| Type |
ID_TEXT |
Returns…
| Description |
The best property value ('best' is dependant on the property we are looking at). |
| Type |
mixed |
function ocf_get_best_group_property($groups,$property)
{
$big_is_better=array('gift_points_per_day','gift_points_base','enquire_on_new_ips','is_super_admin','is_super_moderator','max_daily_upload_mb','max_attachments_per_post','max_avatar_width','max_avatar_height','max_post_length_comcode','max_sig_length_comcode');
//$small_and_perfectly_formed=array('flood_control_submit_secs','flood_control_access_secs'); Not needed by elimination, but nice to have here as a note
$go_super_size=in_array($property,$big_is_better);
global $USER_GROUPS_CACHED;
ocf_ensure_groups_cached($groups);
$best_value_so_far=0; // Initialise type to integer
$best_value_so_far=NULL;
foreach ($groups as $group)
{
$this_value=$USER_GROUPS_CACHED[$group]['g_'.$property];
if ((is_null($best_value_so_far)) ||
(($best_value_so_far<$this_value) && ($go_super_size)) ||
(($best_value_so_far>$this_value) && (!$go_super_size)))
$best_value_so_far=$this_value;
}
return $best_value_so_far;
}
array ocf_get_members_groups(?MEMBER member_id, boolean skip_secret, boolean handle_probation)
Get a list of the usergroups a member is in (keys say the usergroups, values are irrelevant).
Parameters…
| Name |
member_id |
| Description |
The member to find the usergroups of (NULL: current member). |
| Default value |
|
| Type |
?MEMBER |
| Name |
skip_secret |
| Description |
Whether to skip looking at secret usergroups. |
| Default value |
boolean-false |
| Type |
boolean |
| Name |
handle_probation |
| Description |
Whether to take probation into account |
| Default value |
boolean-true |
| Type |
boolean |
Returns…
| Description |
Reverse list (e.g. array(1=>1,2=>1,3=>1) for someone in (1,2,3)). |
| Type |
array |
function ocf_get_members_groups($member_id=NULL,$skip_secret=false,$handle_probation=true)
{
if (is_guest($member_id))
{
$ret=array();
$ret[db_get_first_id()]=1;
return $ret;
}
if (is_null($member_id)) $member_id=get_member();
if ($handle_probation)
{
$opt=$GLOBALS['FORUM_DRIVER']->get_member_row_field($member_id,'m_on_probation_until');
if ((!is_null($opt)) && ($opt>time()))
{
global $PROBATION_GROUP;
if (is_null($PROBATION_GROUP))
{
$probation_group=get_option('probation_usergroup');
$PROBATION_GROUP=$GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN '.$GLOBALS['FORUM_DB']->get_table_prefix().'translate t ON t.id=g.g_name','g.id',array('text_original'=>$probation_group));
if (is_null($PROBATION_GROUP)) $PROBATION_GROUP=false;
}
if ($PROBATION_GROUP!==false) return array($PROBATION_GROUP=>1);
}
}
global $GROUP_MEMBERS_CACHE;
if (isset($GROUP_MEMBERS_CACHE[$member_id][$skip_secret][$handle_probation])) return $GROUP_MEMBERS_CACHE[$member_id][$skip_secret][$handle_probation];
$groups=array();
// Now implicit usergroup hooks
$hooks=find_all_hooks('systems','ocf_implicit_usergroups');
foreach (array_keys($hooks) as $hook)
{
require_code('hooks/systems/ocf_implicit_usergroups/'.$hook);
$ob=object_factory('Hook_implicit_usergroups_'.$hook);
if ($ob->is_member_within($member_id)) $groups[$ob->get_bound_group_id()]=1;
}
require_code('ocf_members');
if ((!function_exists('ocf_is_ldap_member')/*can happen if said in safe mode and detecting safe mode when choosing whether to avoid a custom file via admin permission which requires this function to run*/) || (!ocf_is_ldap_member($member_id)))
{
$no_hidden=(/*For installer*/!function_exists('get_member')) || (($member_id!=get_member()) && (($skip_secret) || (!function_exists('has_specific_permission')) || (!has_specific_permission(get_member(),'see_hidden_groups'))));
$_groups=$GLOBALS['FORUM_DB']->query_select('f_group_members m LEFT JOIN '.$GLOBALS['FORUM_DB']->get_table_prefix().'f_groups g ON g.id=m.gm_group_id',array('gm_group_id','g_hidden'),array('gm_member_id'=>$member_id,'gm_validated'=>1),'ORDER BY g.g_order');
foreach ($_groups as $group)
$groups[$group['gm_group_id']]=1;
if (!isset($GLOBALS['OCF_DRIVER'])) // We didn't init fully (MICRO_BOOTUP), but now we dug a hole - get out of it
{
if (method_exists($GLOBALS['FORUM_DRIVER'],'forum_layer_initialise')) $GLOBALS['FORUM_DRIVER']->forum_layer_initialise();
}
$primary_group=$GLOBALS['OCF_DRIVER']->get_member_row_field($member_id,'m_primary_group');
if (is_null($primary_group)) $primary_group=db_get_first_id();
$groups[$primary_group]=1;
foreach (array_keys($groups) as $group_id)
{
$groups[$group_id]=1;
}
$GROUP_MEMBERS_CACHE[$member_id][false][$handle_probation]=$groups;
$groups2=$groups;
foreach ($_groups as $group)
{
if ($group['g_hidden']==1)
unset($groups2[$group['gm_group_id']]);
}
$GROUP_MEMBERS_CACHE[$member_id][true][$handle_probation]=$groups2;
if ($no_hidden) $groups=$groups2;
} else
{
$groups=ocf_get_members_groups_ldap($member_id);
$GROUP_MEMBERS_CACHE[$member_id][false][$handle_probation]=$groups;
$GROUP_MEMBERS_CACHE[$member_id][true][$handle_probation]=$groups;
// Mirror to f_group_members table, so direct queries will also get it (we need to do listings of group members, for instance)
$GLOBALS['FORUM_DB']->query_delete('f_group_members',array('gm_member_id'=>$member_id));
foreach (array_keys($groups) as $group_id)
{
$GLOBALS['FORUM_DB']->query_insert('f_group_members',array(
'gm_group_id'=>$group_id,
'gm_member_id'=>$member_id,
'gm_validated'=>1
));
}
}
return $groups;
}
?AUTO_LINK find_usergroup_id(SHORT_TEXT title)
Get the ID for a usergroup if we only know the title. Warning: Only use this with custom code, never core code! It assumes a single language and that usergroups aren't renamed.
Parameters…
| Name |
title |
| Description |
The title. |
| Type |
SHORT_TEXT |
Returns…
| Description |
The ID (NULL: could not find). |
| Type |
?AUTO_LINK |
function find_usergroup_id($title)
{
$usergroups=$GLOBALS['FORUM_DRIVER']->get_usergroup_list();
foreach ($usergroups as $id=>$usergroup)
{
if ($usergroup==$title)
{
return $id;
}
}
return NULL;
}
sources/ocf_groups_action.php
Global_functions_ocf_groups_action.php
Function summary
|
AUTO_LINK
|
ocf_make_group (SHORT_TEXT name, BINARY is_default, BINARY is_super_admin, BINARY is_super_moderator, SHORT_TEXT title, URLPATH rank_image, ?GROUP promotion_target, ?integer promotion_threshold, ?MEMBER group_leader, integer flood_control_submit_secs, integer flood_control_access_secs, integer max_daily_upload_mb, integer max_attachments_per_post, integer max_avatar_width, integer max_avatar_height, integer max_post_length_comcode, integer max_sig_length_comcode, integer gift_points_base, integer gift_points_per_day, BINARY enquire_on_new_ips, BINARY is_presented_at_install, BINARY hidden, ?integer order, BINARY rank_image_pri_only, BINARY open_membership, BINARY is_private_club)
|
AUTO_LINK ocf_make_group(SHORT_TEXT name, BINARY is_default, BINARY is_super_admin, BINARY is_super_moderator, SHORT_TEXT title, URLPATH rank_image, ?GROUP promotion_target, ?integer promotion_threshold, ?MEMBER group_leader, integer flood_control_submit_secs, integer flood_control_access_secs, integer max_daily_upload_mb, integer max_attachments_per_post, integer max_avatar_width, integer max_avatar_height, integer max_post_length_comcode, integer max_sig_length_comcode, integer gift_points_base, integer gift_points_per_day, BINARY enquire_on_new_ips, BINARY is_presented_at_install, BINARY hidden, ?integer order, BINARY rank_image_pri_only, BINARY open_membership, BINARY is_private_club)
Add a usergroup.
Parameters…
| Name |
name |
| Description |
The name of the usergroup. |
| Type |
SHORT_TEXT |
| Name |
is_default |
| Description |
Whether members are automatically put into the when they join. |
| Type |
BINARY |
| Name |
is_super_admin |
| Description |
Whether members of this usergroup are all super administrators. |
| Type |
BINARY |
| Name |
is_super_moderator |
| Description |
Whether members of this usergroup are all super moderators. |
| Type |
BINARY |
| Name |
title |
| Description |
The title for primary members of this usergroup that don't have their own title. |
| Type |
SHORT_TEXT |
| Name |
rank_image |
| Description |
The rank image for this. |
| Default value |
|
| Type |
URLPATH |
| Name |
promotion_target |
| Description |
The that members of this usergroup get promoted to at point threshold (NULL: no promotion prospects). |
| Default value |
|
| Type |
?GROUP |
| Name |
promotion_threshold |
| Description |
The point threshold for promotion (NULL: no promotion prospects). |
| Default value |
|
| Type |
?integer |
| Name |
group_leader |
| Description |
The leader of this usergroup (NULL: none). |
| Default value |
|
| Type |
?MEMBER |
| Name |
flood_control_submit_secs |
| Description |
The number of seconds that members of this usergroup must endure between submits (group 'best of' applies). |
| Default value |
5 |
| Type |
integer |
| Name |
flood_control_access_secs |
| Description |
The number of seconds that members of this usergroup must endure between accesses (group 'best of' applies). |
| Default value |
0 |
| Type |
integer |
| Name |
max_daily_upload_mb |
| Description |
The number of megabytes that members of this usergroup may attach per day (group 'best of' applies). |
| Default value |
70 |
| Type |
integer |
| Name |
max_attachments_per_post |
| Description |
The number of attachments that members of this usergroup may attach to something (group 'best of' applies). |
| Default value |
50 |
| Type |
integer |
| Name |
max_avatar_width |
| Description |
The maximum avatar width that members of this usergroup may have (group 'best of' applies). |
| Default value |
100 |
| Type |
integer |
| Name |
max_avatar_height |
| Description |
The maximum avatar height that members of this usergroup may have (group 'best of' applies). |
| Default value |
100 |
| Type |
integer |
| Name |
max_post_length_comcode |
| Description |
The maximum post length that members of this usergroup may make (group 'best of' applies). |
| Default value |
30000 |
| Type |
integer |
| Name |
max_sig_length_comcode |
| Description |
The maximum signature length that members of this usergroup may make (group 'best of' applies). |
| Default value |
700 |
| Type |
integer |
| Name |
gift_points_base |
| Description |
The number of gift points that members of this usergroup start with (group 'best of' applies). |
| Default value |
25 |
| Type |
integer |
| Name |
gift_points_per_day |
| Description |
The number of gift points that members of this usergroup get per day (group 'best of' applies). |
| Default value |
1 |
| Type |
integer |
| Name |
enquire_on_new_ips |
| Description |
Whether e-mail confirmation is needed for new IP addresses seen for any member of this usergroup (group 'best of' applies). |
| Default value |
0 |
| Type |
BINARY |
| Name |
is_presented_at_install |
| Description |
Whether the usergroup is presented for joining at joining (implies anyone may be in the, but only choosable at joining) |
| Default value |
0 |
| Type |
BINARY |
| Name |
hidden |
| Description |
Whether the name and membership of the is hidden |
| Default value |
0 |
| Type |
BINARY |
| Name |
order |
| Description |
The display order this will be given, relative to other usergroups. Lower numbered usergroups display before higher numbered usergroups (NULL: next). |
| Default value |
|
| Type |
?integer |
| Name |
rank_image_pri_only |
| Description |
Whether the rank image will not be shown for secondary membership |
| Default value |
1 |
| Type |
BINARY |
| Name |
open_membership |
| Description |
Whether members may join this usergroup without requiring any special permission |
| Default value |
0 |
| Type |
BINARY |
| Name |
is_private_club |
| Description |
Whether this usergroup is a private club. Private clubs may be managed in the CMS zone, and do not have any special permissions - except over their own associated forum. |
| Default value |
0 |
| Type |
BINARY |
Returns…
| Description |
The ID of the new. |
| Type |
AUTO_LINK |
function ocf_make_group($name,$is_default,$is_super_admin,$is_super_moderator,$title,$rank_image='',$promotion_target=NULL,$promotion_threshold=NULL,$group_leader=NULL,$flood_control_submit_secs=5,$flood_control_access_secs=0,$max_daily_upload_mb=70,$max_attachments_per_post=50,$max_avatar_width=100,$max_avatar_height=100,$max_post_length_comcode=30000,$max_sig_length_comcode=700,$gift_points_base=25,$gift_points_per_day=1,$enquire_on_new_ips=0,$is_presented_at_install=0,$hidden=0,$order=NULL,$rank_image_pri_only=1,$open_membership=0,$is_private_club=0)
{
// if (is_null($group_leader)) $group_leader=db_get_first_id()+1;
if (!running_script('stress_test_loader'))
{
$test=$GLOBALS['FORUM_DB']->query_value_null_ok('f_groups g LEFT JOIN '.$GLOBALS['FORUM_DB']->get_table_prefix().'translate t ON g.g_name=t.id WHERE '.db_string_equal_to('text_original',$name),'g.id');
if (!is_null($test)) warn_exit(do_lang_tempcode('ALREADY_EXISTS',escape_html($name)));
}
if (is_null($is_super_admin)) $is_super_admin=0;
if (is_null($is_super_moderator)) $is_super_moderator=0;
if (!running_script('stress_test_loader'))
{
if (is_null($order))
{
$order=$GLOBALS['FORUM_DB']->query_value('f_groups','MAX(g_order)');
if (is_null($order)) $order=0; else $order++;
}
} else $order=100;
$group_id=$GLOBALS['FORUM_DB']->query_insert('f_groups',array(
'g_name'=>insert_lang($name,2,$GLOBALS['FORUM_DB']),
'g_is_default'=>$is_default,
'g_is_presented_at_install'=>$is_presented_at_install,
'g_is_super_admin'=>$is_super_admin,
'g_is_super_moderator'=>$is_super_moderator,
'g_group_leader'=>$group_leader,
'g_title'=>insert_lang($title,2,$GLOBALS['FORUM_DB']),
'g_promotion_target'=>$promotion_target,
'g_promotion_threshold'=>$promotion_threshold,
'g_flood_control_submit_secs'=>$flood_control_submit_secs,
'g_flood_control_access_secs'=>$flood_control_access_secs,
'g_max_daily_upload_mb'=>$max_daily_upload_mb,
'g_max_attachments_per_post'=>$max_attachments_per_post,
'g_max_avatar_width'=>$max_avatar_width,
'g_max_avatar_height'=>$max_avatar_height,
'g_max_post_length_comcode'=>$max_post_length_comcode,
'g_max_sig_length_comcode'=>$max_sig_length_comcode,
'g_gift_points_base'=>$gift_points_base,
'g_gift_points_per_day'=>$gift_points_per_day,
'g_enquire_on_new_ips'=>$enquire_on_new_ips,
'g_rank_image'=>$rank_image,
'g_hidden'=>$hidden,
'g_order'=>$order,
'g_rank_image_pri_only'=>$rank_image_pri_only,
'g_open_membership'=>$open_membership,
'g_is_private_club'=>$is_private_club,
),true);
if (($group_id>db_get_first_id()+8) && ($is_private_club==0))
{
// Copy permissions from members
require_code('ocf_groups');
$group_members=get_first_default_group();
$member_access=$GLOBALS['SITE_DB']->query_select('gsp',array('*'),array('group_id'=>$group_members));
foreach ($member_access as $access)
{
$access['group_id']=$group_id;
$GLOBALS['SITE_DB']->query_insert('gsp',$access,false,true); // failsafe, in case we have put in some permissions for a group since deleted (can happen during install)
}
$member_access=$GLOBALS['SITE_DB']->query_select('group_category_access',array('*'),array('group_id'=>$group_members));
foreach ($member_access as $access)
{
$access['group_id']=$group_id;
$GLOBALS['SITE_DB']->query_insert('group_category_access',$access,false,true); // failsafe, in case we have put in some permissions for a group since deleted (can happen during install)
}
$member_access=$GLOBALS['SITE_DB']->query_select('group_zone_access',array('*'),array('group_id'=>$group_members));
foreach ($member_access as $access)
{
$access['group_id']=$group_id;
$GLOBALS['SITE_DB']->query_insert('group_zone_access',$access,false,true); // failsafe, in case we have put in some permissions for a group since deleted (can happen during install)
}
}
log_it('ADD_GROUP',strval($group_id),$name);
if ($is_private_club==1)
{
require_code('notifications');
$subject=do_lang('NEW_CLUB_NOTIFICATION_MAIL_SUBJECT',get_site_name(),$name);
$view_url=build_url(array('page'=>'groups','type'=>'view','id'=>$group_id),get_module_zone('groups'),NULL,false,false,true);
$mail=do_lang('NEW_CLUB_NOTIFICATION_MAIL',get_site_name(),comcode_escape($name),array(comcode_escape($view_url->evaluate())));
dispatch_notification('ocf_club',NULL,$subject,$mail);
}
return $group_id;
}
0 reviews: Unrated (average)
There have been no comments yet