Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter kalor

    (@kalor)

    If you want to use it with your WP, here’s how to do it without changing the code of core WP, with use of function.php file form your theme:

    http://wordpress.stackexchange.com/questions/44966/how-can-i-add-extra-attribute-in-the-page-attribute-section-in-wp-admin-for-pa

    Thread Starter kalor

    (@kalor)

    It solves the problem.

    It will be better idea to remake it as a plugin, not to keep changes directly in WordPress core.

    function page_attributes_meta_box($post) {
    	$post_type_object = get_post_type_object($post->post_type);
    	if ( $post_type_object->hierarchical ) {
    /* added stuff start */
    		$_checkcurrent_user_id = get_current_user_id();
    		$authors_info_check = get_userdata($_checkcurrent_user_id);
    /* added stuff end */
    		$dropdown_args = array(
    			'post_type'        => $post->post_type,
    			'exclude_tree'     => $post->ID,
    			'selected'         => $post->post_parent,
    			'name'             => 'parent_id',
    			'show_option_none' => __('(no parent)'),
    			'sort_column'      => 'menu_order, post_title',
    			'echo'             => 0,
    /* added stuff start */
    			'authors' => $authors_info_check->user_login,
    /* added stuff end */
    		);
    Thread Starter kalor

    (@kalor)

    Roles won’t work with this thing. I’ve already used it to limit the user access to their pages and posts only.

    Attaching the page to another as a child isn’t limited by roles and by wordpress itself. Every user that is able to add new page can mark it as a child of every page that is already in system.

    The idea is to modify or filter the page_attributes_meta_box() function in \wp-admin\includes\meta-boxes.php

    It uses wp_dropdown_pages() and accordint to codex “It is possible, but not confirmed, some of the paramters for the function get_pages could be used for wp_dropdown_pages.” One of the parameter is ‘authors’, and it’s possible to check the author role.

    So, I think it’s possible but it’s to hard piece of programming for me.

Viewing 3 replies - 1 through 3 (of 3 total)