Exemple #1
0
/**
 * Visual Composer component.
 *
 * @since  1.0.0
 */
function mm_vc_users()
{
    $roles = mm_get_user_roles_for_vc('mm-users');
    $templates = mm_get_mm_users_templates_for_vc('mm-users');
    $wrap_elements = mm_get_wrap_elements_for_vc('mm-users');
    $empty_option = array(__('All Users', 'mm-components') => '');
    $roles = $empty_option + $roles;
    vc_map(array('name' => __('Users', 'mm-components'), 'base' => 'mm_users', 'class' => '', 'icon' => MM_COMPONENTS_ASSETS_URL . 'component-icon.png', 'category' => __('Content', 'mm-components'), 'params' => array(array('type' => 'dropdown', 'heading' => __('User Role', 'mm-components'), 'param_name' => 'role', 'description' => __('Select a specific user role to only include users with that role', 'mm-components'), 'value' => $roles), array('type' => 'textfield', 'heading' => __('Users Per Page', 'mm-components'), 'param_name' => 'number', 'description' => __('Specify the maximum number of users to show at once', 'mm-components'), 'value' => '10'), array('type' => 'dropdown', 'heading' => __('Pagination', 'mm-components'), 'param_name' => 'pagination', 'value' => array(__('None', 'mm-components') => '', __('Next/Prev', 'mm-components') => 'next-prev', __('Page Numbers', 'mm-components') => 'page-numbers')), array('type' => 'dropdown', 'heading' => __('Template', 'mm-components'), 'param_name' => 'template', 'description' => __('Select a template', 'mm-components'), 'value' => $templates), array('type' => 'dropdown', 'heading' => __('Wrap Element', 'mm-components'), 'param_name' => 'wrap_element', 'description' => __('Select a wrap element', 'mm-components'), 'value' => $wrap_elements), array('type' => 'textfield', 'heading' => __('User ID', 'mm-components'), 'param_name' => 'user_id', 'description' => __('Enter a user ID to display a single user', 'mm-components'), 'value' => ''))));
}
/**
 * Visual Composer add-on.
 *
 * @since  1.0.0
 */
function mm_vc_restricted_content()
{
    $roles = mm_get_user_roles_for_vc('mm-restricted-content');
    /**
     * Restricted Content.
     */
    vc_map(array('name' => __('Restricted Content', 'mm-components'), 'base' => 'mm_restricted_content', 'icon' => MM_COMPONENTS_ASSETS_URL . 'restricted-content-icon.png', 'as_parent' => array('except' => ''), 'is_container' => true, 'params' => array(array('type' => 'checkbox', 'heading' => __('Restrict to specific user roles?', 'mm-components'), 'param_name' => 'specific_roles', 'description' => __('By default only logged in users will see the restricted content. Check this to further restrict to specific user roles.', 'mm-components'), 'value' => array(__('Yes', 'mm-components') => 0)), array('type' => 'checkbox', 'heading' => __('Allowed User Roles', 'mm-components'), 'param_name' => 'roles', 'description' => __('Select the user role(s) that should be allowed to view the restricted content.', 'mm-components'), 'value' => $roles, 'dependency' => array('element' => 'specific_roles', 'not_empty' => true)), array('type' => 'textarea_raw_html', 'heading' => __('Alternate Content', 'mm-components'), 'param_name' => 'other_content', 'description' => __('The content entered here will be shown to users who do not meet the criteria set above. HTML and shortcodes are allowed.', 'mm-components'), 'value' => '')), 'js_view' => 'VcColumnView'));
}