Code Monkey home page Code Monkey logo

cmb2-metatabs-options's People

Contributors

hsleonis avatar rogerlos avatar rubengc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmb2-metatabs-options's Issues

Support PHP 5.6

Defining arrays using [] is supporting from PHP 5.4

But I found some servers with php 5.6 that do not recognizes this expresion

Anyway for maximum compatibility I suggest to replace it with array()

Add Composer File

It would be useful to add a composer.json file to you project.

{
    "name": "rogerlos/cmb2-metatabs-options",
    "description": "Extends CMB2 to allow WordPress options pages with multiple metaboxes and optional tabs.",
    "type": "wordpress-plugin",
    "require": {
        "webdevstudios/cmb2": "^2.2"
    },
    "license": "GPLv2",
    "authors": [
        {
            "name": "Roger Los",
            "email": "[email protected]"
        }
    ],
    "minimum-stability": "stable"
}

Activating the page for a specific user role

Hi !
I'm glad you updated after my comments :)
I have a last difficulty though, probably a simple problem not linked to the code you wrote: i'm trying to make the option page (created following your example) accessible to a user which for i created a specific role. This user role does not have access to the optons-general.php page.

What should i provide as 'topmenu' arg then? How can i create an admin menu item dedicated to this option page ?

Thanks a lot in advance for the help ;)

Reset options button

Will be awesome get this functionallity implemented with the ability to enable/disable and also to set a custom text for the reset button

add package to packagist

without adding it to packagist.org, one cannot composer require rogerlos/cmb2-metatabs-options to bring the package into their project

Private page with files by user

I am thinking about make a private page by user, is it possible?
The idea is by specified role, the users can save their own files in their private page.

Maybe with a hidden field we can save the user_id that is saving files in a group of cmb2 into the private page.

thanks Rogerlos! ;-)

Add Metaboxes to Post and Pages post types

No the same issue from #10

I'm trying to add the metatabs-options to the Post and Page post types and I'm unable to do so. I tried with the $show_on variable and I'm afraid this is not the way to do it.

'topmenu'    => 'edit.php',
'postslug'   => 'page',

With CMB2 I can accomplish this by setting object_type to object_type => array('post', 'page') but I couldn't set it up in your plugin. I would appreciate your help.

screen shot 2016-10-06 at 19 23 30

Thanks for releasing this, amazing stuff.

Support for CMB2 2.2.5

CMB2 2.2.5 adds an automatic handler for options pages (class CMB_Options_Hookup) that automatically add a new admin page with the box registered

We need to disable It for CMO pages because It causes some critical errors (like break the save button)

There is a new box parameter (display_cb) that accepts the value false to disable it

Fatal error: Cannot redeclare rnl_autoloader()

Currently if two projects have your plugin php throws a fatal error because plugin fuctions are redeclared

Updating autoloader.php with this changes the issue get fixes:

<?php
/**
 * RNL AUTOLOADER
 * Looks in /code to see if a file matching the classname exists
 *
 * @param $class
 *
 * @since 1.0.0
 */
if( ! function_exists( 'rnl_autoloader' ) ) {
	function rnl_autoloader( $class ) {
		$base_dir = __DIR__;
		$class = strtolower( $class );
		$file = $base_dir . '/code/' . $class . '.php';
		if ( file_exists( $file ) ) require $file;
	}
}

If your are ok with this changes I can PR them or you can commit them directly

Styling question

Thank you for the plugin, it's very useful.
Is it possible to preserve a standard option page styling for the metaboxes ?
Like this:
image

More accurate css selectors

CMO cleanup css has a rule #side-sortables{padding-top:22px;} that adds an extra padding on the entire wp admin

Adding a prefix to all this rules with .cmo-options-page or #cmo-options-form fixes the issue

Also, if multiple plugins register CMO , this css is registered multiple times

<style type="text/css" id="CMO-cleanup-css">#poststuff h2.nav-tab-wrapper{padding-bottom:0;margin-bottom: 20px;}.opt-hidden{display:none;}#side-sortables{padding-top:22px;}</style>
<style type="text/css" id="CMO-cleanup-css">#poststuff h2.nav-tab-wrapper{padding-bottom:0;margin-bottom: 20px;}.opt-hidden{display:none;}#side-sortables{padding-top:22px;}</style>
<style type="text/css" id="CMO-cleanup-css">#poststuff h2.nav-tab-wrapper{padding-bottom:0;margin-bottom: 20px;}.opt-hidden{display:none;}#side-sortables{padding-top:22px;}</style>

Checking if this has been rendered with a global var could solve the problem

I'm getting a fatal error on line 282

Hi I'm getting the following error?

Fatal error: Using $this when not in object context in ....../wp-content/plugins/hpw-functionality/cmb2-metatabs-options/code/cmb2_metatabs_options.php on line 282

Have tried using the example code instead of my own and I still get the error.

Everything works fine in my single install development environment. When I move the working code to a multisite environment I get this error?

[FEATURE] [CODE-SAMPLE] Function to get values by ID-key easily

Hello everyone,

I've found this function in an other settings-page snippet and I like it very much. Maybe the author want to integrate it into the code.

Now you could get any key with the following line:
echo settingspage_get_option('ID-OF-YOUR-FIELD'):
easy, isn't it?

Source:
https://github.com/WebDevStudios/CMB2-Snippet-Library/tree/master/options-and-settings-pages

Greetings

/* Get value for option-page key */
function settingspage_get_option( $key = '', $default = null ) {

	$options_key = 'settingspage_options';

	if ( function_exists( 'cmb2_get_option' ) ) {
		// Use cmb2_get_option as it passes through some key filters.
		return cmb2_get_option( $options_key, $key, $default );
	}

	// Fallback to get_option if CMB2 is not loaded yet.
	$opts = get_option( $options_key, $key, $default );

	$val = $default;

	if ( 'all' == $key ) {
		$val = $opts;
	} elseif ( array_key_exists( $key, $opts ) && false !== $opts[ $key ] ) {
		$val = $opts[ $key ];
	}

	return $val;
}

Make it easier to edit icon, position and capability

Hi,

I had problems using menuargs in the plugin to edit icon, position and capabilty. So I added the following to the code.

In the props array:
'capability' => 'manage_options', 'icon_url' => 'dashicons-layout', 'position' => 1,

And the build_menu_args-function:
`
private function build_menu_args () {

    // if a menu arguments array was injected, return it
    if ( ! empty( self::$props['menuargs'] ) ) {
        // if menu arguments are less than 7, add empty argument to end, assumes subpage wanted
        if ( count( self::$props['menuargs'] ) < 7 && self::$props['topmenu'] )
            self::$props['menuargs'][] = null;
        return self::$props['menuargs'];
    }

    // otherwise build the menu page from the page title and options-slug
    $args = array();
    if ( self::$props['topmenu'] ) {
        // add a post_type get var, to allow post options pages
        $add = self::$props['postslug'] ? '?post_type=' . self::$props['postslug'] : '';
        $args[] = self::$props['topmenu'] . $add;
    }
    $args[] = $args[] = self::$props['title'];
    $args[] = self::$props['capability'];
    $args[] = self::$props['key'];
    $args[] = array( $this, 'admin_page_display' );
    if ( ! self::$props['topmenu'] )
        $args[] = self::$props['icon_url'];
    $args[] = self::$props['position'];

    return $args;
}`

Would be a great and easier way to add those parameters

How to add a capability ??

Could you tell me how you would add a capability to view the link in the admin menu AND edit the settings page created with this class ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.