Plugin Directory

Changeset 2498952


Ignore:
Timestamp:
03/18/2021 07:22:17 PM (5 years ago)
Author:
pressmate
Message:

Gutenberg fixes and Roles manager added

Location:
makestories-helper/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • makestories-helper/trunk/config.php

    r2490587 r2498952  
    44 */
    55define("MS_CDN_URL", "https://api.makestories.io/wp/2.1/");
     6
    67
    78
     
    6364    "forceUploadMedia" => false,
    6465    "default_category" => "Uncategorized",
     66    "roles" => ["editor", "author", "administrator"],
    6567]);
  • makestories-helper/trunk/gutenberg-block.php

    r2481773 r2498952  
    1010        'icon' => MS_ROUTING['EDITOR']['icon']
    1111    ]);
    12    
    13     // For all publish post display
    14     register_block_type('makestories/custom-block-all-published-post', array(
    15         'editor_script' => 'custom-cta-js'
    16     ) );
    17    
    18     // For display posts by category
    19     register_block_type('makestories/custom-block-category-post', array(
    20         'editor_script' => 'custom-cta-js'
    21     ) );
    2212
    23     // For display single post
    24     register_block_type('makestories/custom-block-single-post', array(
    25         'editor_script' => 'custom-cta-js'
    26     ) );
     13    if(function_exists("register_block_type")){
     14        // For all publish post display
     15        register_block_type('makestories/custom-block-all-published-post', array(
     16            'editor_script' => 'custom-cta-js'
     17        ) );
     18
     19        // For display posts by category
     20        register_block_type('makestories/custom-block-category-post', array(
     21            'editor_script' => 'custom-cta-js'
     22        ) );
     23
     24        // For display single post
     25        register_block_type('makestories/custom-block-single-post', array(
     26            'editor_script' => 'custom-cta-js'
     27        ) );
     28    }
    2729}
    2830
  • makestories-helper/trunk/helpers.php

    r2490587 r2498952  
    5252        $options['default_category'] = $_POST['default_category'];
    5353    }
     54    if(isset($_POST['roles']) && is_array($_POST['roles'])){
     55        $options['roles'] = $_POST['roles'];
     56    }
    5457    $options['to_rewrite'] = true;
    5558    if(isset($_POST['forceUploadMedia'])){
     
    7780
    7881function ms_get_allowed_roles(){
    79     return ["editor", "author", "manage_options"];
     82    $config = ms_get_options();
     83    return $config['roles'];
    8084}
    8185
  • makestories-helper/trunk/makestories.php

    r2490589 r2498952  
    44Plugin URI:     https://www.notion.so/MakeStories-WordPress-Plugin-Set-Up-Guide-d903e700c9204ef08f9751bb4a101068
    55Description:    Visual storytelling for WordPress. Made possible by MakeStories.
    6 Version:        2.2.2
     6Version:        2.2.3
    77Author:         MakeStories Team
    88Author URI:     http://makestories.io
  • makestories-helper/trunk/pages/category-structure.php

    r2490621 r2498952  
    1717   
    1818    $options = ms_get_options();
     19
     20    global $wp_roles;
     21    if ( ! isset( $wp_roles ) ) $wp_roles = new WP_Roles();
     22
     23    $roleNames = $wp_roles->get_names();
    1924    ?>
    2025    <!-- Catgeory-wrap start -->
     
    6267            </tr>
    6368            <tr>
    64                 <hr/>
     69                <td colspan="2">
     70                    <hr/>
     71                </td>
     72            </tr>
     73            <tr>
     74                <th scope="row"><label for="categories">Roles allowed access to MakeStories</label></th>
     75                <td>
     76                    <fieldset>
     77                        <?php
     78                        foreach($roleNames as $role => $roleName) { ?>
     79                            <label for="role_input_<?php echo $role; ?>">
     80                                <input name="roles[]" type="checkbox" id="role_input_<?php echo $role; ?>" value="<?php echo $role; ?>"  <?php if(in_array($role, $options['roles'])){ echo "checked"; } ?>>
     81                                <?php echo $roleName; ?></label>
     82                            <br>
     83                            <?php
     84                        }
     85                        ?>
     86                    </fieldset>
     87                </td>
     88            </tr>
     89            <tr>
     90                <td colspan="2">
     91                    <hr/>
     92                </td>
    6593            </tr>
    6694            <tr>
Note: See TracChangeset for help on using the changeset viewer.