Changeset 9566


Ignore:
Timestamp:
03/07/11 20:37:54 (9 years ago)
Author:
plg
Message:

at plugin activation time, if there is no permission after upgrade from
community 2.1 and core 2.1, create a default permission : any registered
user, album "Community" (automatic creation), sub-albums + ability to create
new sub albums.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/community/maintain.inc.php

    r9539 r9566  
    106106function plugin_activate() 
    107107{ 
     108  global $prefixeTable; 
     109 
    108110  community_get_data_from_core21(); 
    109111  community_get_data_from_community21(); 
     112 
     113  $query = ' 
     114SELECT 
     115    COUNT(*) 
     116  FROM '.$prefixeTable.'community_permissions 
     117;'; 
     118  list($counter) = pwg_db_fetch_row(pwg_query($query)); 
     119  if (0 == $counter) 
     120  { 
     121    community_create_default_permission(); 
     122  } 
    110123} 
    111124 
     
    297310  } 
    298311} 
     312 
     313function community_create_default_permission() 
     314{ 
     315  global $prefixeTable; 
     316   
     317  // create an album "Community" 
     318  $category_info = create_virtual_category('Community'); 
     319 
     320  $insert = array( 
     321    'type' => 'any_registered_user', 
     322    'category_id' => $category_info['id'], 
     323    'recursive' => 'true', 
     324    'create_subcategories' => 'true', 
     325    'moderated' => 'true', 
     326    ); 
     327 
     328  mass_inserts($prefixeTable.'community_permissions', array_keys($insert), array($insert)); 
     329 
     330  conf_update_param('community_update', time()); 
     331} 
    299332?> 
Note: See TracChangeset for help on using the changeset viewer.