Plugin Directory

Changeset 1666303


Ignore:
Timestamp:
05/29/2017 08:47:11 AM (9 years ago)
Author:
netdelight
Message:

fix capabilities & add NL translations

Location:
sharing-club/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sharing-club/trunk/readme.txt

    r1662392 r1666303  
    6060
    6161== Changelog ==
     62= 1.2 =
     63- Fixed the capabilities bug for admin.
     64- Added dutch translation (thanks again Jeroen).
     65
    6266= 1.1 =
    6367- For each object, you can use the "excerpt" field to write a short note for admin purpose (ie : library reference, useful comment) to help you manage your objects
  • sharing-club/trunk/sharing-club.php

    r1662346 r1666303  
    55Description: Share books, dvd, tools, toys or any object with your friends or community. Your users can easily lend, borrow and rate items while you keep a track of what is shared and who borrowed what.
    66Author: Manu Z.
    7 Version: 1.1
     7Version: 1.2
    88Author URI: http://netdelight.be/
    99Text Domain: sharing-club
     
    6161register_activation_hook( __FILE__, 'scwp_plugin_activate' );
    6262
    63 function scwp_admin_init() {
     63function scwp_init() {
    6464    //if ( current_user_can( 'manage_options' ) ) {
    6565        $object = array(
     
    8080            'public' => true,
    8181            'publicly_queryable' => true,
    82             // meta capabilities (enable roles customization)
    83             // see https://wordpress.stackexchange.com/questions/14553/allow-member-to-have-access-to-custom-post-type-only-permission-to-only-edit-th
    84             'capability_type' => 'shared_item',
    85             'map_meta_cap' => true,
     82            'has_archive' => true,
     83            'rewrite' => array('slug' => 'shared_item'),
    8684            'supports' => array(
    8785                'title',
     
    9189                'custom-fields'
    9290            ),
    93             'has_archive' => true,
    94             'rewrite' => array('slug' => 'shared_item')
    95         );
     91            // meta capabilities (enable roles customization)
     92            // see https://wordpress.stackexchange.com/questions/14553/allow-member-to-have-access-to-custom-post-type-only-permission-to-only-edit-th
     93            'capability_type' => 'shared_item',
     94            'capabilities' => array(
     95                'edit_post' => 'edit_shared_item',
     96                'edit_posts' => 'edit_shared_item',
     97                'edit_others_posts' => 'edit_other_shared_item',
     98                'publish_posts' => 'publish_shared_item',
     99                'read_post' => 'read_shared_item',
     100                'read_private_posts' => 'read_private_shared_item',
     101                'delete_post' => 'delete_shared_item',
     102                'delete_posts' => 'delete_shared_item'
     103            ),           
     104        );
     105   
     106        function scwp_admin_init(){
     107            $role = get_role( 'administrator' );
     108            $role->add_cap( 'publish_shared_item' );
     109            $role->add_cap( 'edit_shared_item' );
     110            $role->add_cap( 'edit_others_shared_item' );
     111            $role->add_cap( 'delete_shared_item' );
     112            $role->add_cap( 'delete_others_shared_item' );
     113            $role->add_cap( 'read_private_shared_item' );
     114        }
     115
     116        add_action('admin_init', 'scwp_admin_init');
     117
    96118        register_post_type('shared_item', $object);
    97119
     
    126148    //}
    127149}
    128 add_action('init', 'scwp_admin_init');
    129 
     150add_action('init', 'scwp_init');
    130151
    131152function scwp_display_lending_table(){
Note: See TracChangeset for help on using the changeset viewer.