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

    (@paulovsky)

    I assume the code has to be somewhere here:

    /**
     * Add the taxonomies to the user view/edit screen
     * 
     * @param Object $user	- The user of the view/edit screen
     */
    public function user_profile($user) {
    	
    	// Using output buffering as we need to make sure we have something before outputting the header
    	// But we can't rely on the number of taxonomies, as capabilities may vary
    	ob_start();
    	
    	foreach(self::$taxonomies as $key=>$taxonomy):
    		// Check the current user can assign terms for this taxonomy
    		//if(!current_user_can($taxonomy->cap->assign_terms)) continue;
    		// Get all the terms in this taxonomy
    		$terms		= get_terms($key, array('hide_empty'=>false));
    		$stack 		= wp_list_pluck( wp_get_object_terms( $user->ID, $key ), 'slug' );
    		$input_type = ( isset($taxonomy->single_value) && ($taxonomy->single_value == true) ) ? 'radio' : 'checkbox' ;
    		?>
    
    			<table class="form-table">
    				<tr>
    					<th><label for=""><?php _e("Select {$taxonomy->labels->singular_name}")?></label></th>
    					<td>
    						<?php if(!empty($terms)): ?>
    
    							<?php $this->renderTree( $this->buildTree( $terms ), $stack, $user, $key, $input_type ); ?>
    
    						<?php else:?>
    							<?php _e("There are no {$taxonomy->name} available.")?>
    						<?php endif?>
    					</td>
    				</tr>
    			</table>
    
    	<?php endforeach; // Taxonomies
    	// Output the above if we have anything, with a heading
    	$output	= ob_get_clean();
    	if(!empty($output)) {
    		echo '<h3>', __('Company Details'), '</h3>';
    		echo $output;
    	}
    }
    • This reply was modified 6 years, 9 months ago by paulovsky.
    Plugin Author shawfactor

    (@shawfactor)

    register_taxonomy (wgich you need to register your taxonomy), has a capabiltty parameter. You can use this to customise which role can view or modify the custom user taxonomy you create. This article should point you in the right direction:

    https://wordpress.stackexchange.com/questions/155629/custom-taxonomies-capabilities?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

    Plugin Author shawfactor

    (@shawfactor)

    I am resolving this for good order as I believe this plugin respects the capabilities parameter used in register_taxonomy.

    If this is not the case then either open an new thread or reply to this (I will still monitor this thread)

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘disable edits by own user’ is closed to new replies.