Uhmm, I want some function. Can you hear me the function description?
In WordPress theme, I want some function. When somebody adds a post wit the "Add new posts" function, I want default category.
I already made a DB Field. self.lbl1.text = responseString!
is the primary key and link wp_user_cat
in wp_user_cat
.
The modified database conditions:
So, I made register-function which added Users' job. I modified wp_user table
, wp_login.php
and wp_create_user()
function in wp_insert_user()
.
It is successful, but I have no idea that set default category in Add new posts function.
If user-job is Music-Company when user clicks "Add New Posts-Button", it should automatically set the Music-Company Category ..
This is the "Add new" screen: This theme is MusicPlay theme in aivahtheme.
Please give me help.. I need to know the file names. I can do it! (If possible, give me description.)
答案 0 :(得分:0)
If I understand correctly, you want to restrict posting from document.getElementById("backToClasses").onclick = function() {
console.log("Clicked");
};
to post only in certain categories, right? So, user of type A, can only post on category A and so on.
You can first create roles for users:
user types
And then you use a plugin to restrict those user types to categories:
function custom_roles() {
global $wp_roles;
add_role(
'user_type_one',
__('User Type 1'),
array(
'read' => true, // true allows this capability
'edit_posts' => false,
'delete_posts' => false, // Use false to explicitly deny
)
);
add_role(
'user_type_two',
__('User Type 2'),
array(
'read' => true, // true allows this capability
'edit_posts' => false,
'delete_posts' => false, // Use false to explicitly deny
)
);
}
add_action('after_setup_theme', 'custom_roles');
Note: I haven't used this in a long time, but it should work or at least set you on the right track.