Ken Stone
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Custom Post Type and User RolePretty close to what I’m looking to achieve only one thing is that Merchant_1 is able to see Merchant_2, etc. in the admin list of the CPT posts, but they can not read, edit, delete, etc.
I tried many combinations of capabilities but nothing seems to affect that. Possibly maybe I can hook into the admin table that displays the CPT and only output a row if the publisher matches the current user or is an administrator.
remove_role('ebf_merchant'); $result = add_role('ebf_merchant', __('Merchant'), array( 'edit_credit_app' => true, 'edit_credit_apps' => true, 'edit_published_credit_apps' => true, 'delete_credit_app' => true, 'delete_published_credit_apps' => true, 'publish_credit_apps' => true, ) ); $admin_role = get_role( 'administrator' ); $admin_role->add_cap( 'read_credit_app' ); $admin_role->add_cap( 'read_credit_apps' ); $admin_role->add_cap( 'edit_credit_app' ); $admin_role->add_cap( 'edit_credit_apps' ); $admin_role->add_cap( 'edit_others_credit_apps' ); $admin_role->add_cap( 'edit_private_credit_apps' ); $admin_role->add_cap( 'edit_published_credit_apps' ); $admin_role->add_cap( 'publish_credit_apps' ); $admin_role->add_cap( 'delete_credit_app' ); $admin_role->add_cap( 'delete_others_credit_apps' ); $admin_role->add_cap( 'delete_private_credit_apps' ); $admin_role->add_cap( 'delete_published_credit_apps' );
$rpt_arg = array( 'labels' => array( 'name' => __( 'Credit Application', $this->plugin_name ), 'singular_name' => __( 'Credit Application', $this->plugin_name ), 'menu_name' => __( 'Credit Applications', $this->plugin_name ), 'name_admin_bar' => __( 'Credit Applications', $this->plugin_name ), 'add_new' => __( 'Credit Application', $this->plugin_name ), 'add_new_item' => __( 'Credit Application', $this->plugin_name ), 'new_item' => __( 'Credit Application', $this->plugin_name ), 'not_found' => __( 'Application Not Found', $this->plugin_name ), 'all_items' => __( 'All Credit Applications', $this->plugin_name ), ), 'exclude_from_search' => true, 'publicly_queryable' => false, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => false, 'has_archive' => false, 'supports' => array( 'title', 'editor', 'author', 'custom-fields' ), 'rewrite' => false, 'capability_type' => array('credit_app','credit_apps'), 'map_meta_cap' => true, ); $post_type = register_post_type('credit_app', $rpt_arg);
Forum: Developing with WordPress
In reply to: Custom Post Type and User RoleActually this makes sense because I have the type set to ‘post’
I don’t want Merchants being able to do anything except view/edit the CPT. So since I have capability type set to ‘post’ the Merchants can’t see it?And an Author can ‘post’. So maybe I need to look again at
'capability_type' => 'post',
Forum: Developing with WordPress
In reply to: Custom Post Type and User RoleI managed to obtain the opposite of my intent.
An Author is able to see the CPT and a Merchant is not.$rpt_arg = array( 'labels' => array( 'name' => __( 'Credit Application', $this->plugin_name ), 'singular_name' => __( 'Credit Application', $this->plugin_name ), 'menu_name' => __( 'Credit Applications', $this->plugin_name ), 'name_admin_bar' => __( 'Credit Applications', $this->plugin_name ), 'add_new' => __( 'Credit Application', $this->plugin_name ), 'add_new_item' => __( 'Credit Application', $this->plugin_name ), 'new_item' => __( 'Credit Application', $this->plugin_name ), 'not_found' => __( 'Application Not Found', $this->plugin_name ), 'all_items' => __( 'All Credit Applications', $this->plugin_name ), ), 'exclude_from_search' => true, 'publicly_queryable' => false, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => false, 'has_archive' => false, 'supports' => array( 'title', 'editor', 'author', 'custom-fields' ), 'rewrite' => false, 'capability_type' => 'post', 'map_meta_cap' => true, ); $post_type = register_post_type('credit_app', $rpt_arg); $caps = get_post_type_capabilities($rpt_arg);
caps gets set to:
caps: stdClass Object ( [create_posts] => )
add_role I have set to:
$result = add_role('ebf_merchant', __('Merchant'), array( 'read' => true, 'edit_credit_app' => true, 'read_credit_app' => true, 'delete_credit_app' => true, 'publish_credit_apps' => true ) );
which gives this:
merchant_role: WP_Role Object ( [name] => ebf_merchant [capabilities] => Array ( [read] => 1 [edit_credit_app] => 1 [read_credit_app] => 1 [delete_credit_app] => 1 [publish_credit_apps] => 1 ) )
Forum: Developing with WordPress
In reply to: Custom Post Type and User RoleThank you Mr Case I will check it out now.
I’ve been through quite a few iterations of this both with and without the capabilities array, tried using the map_meta_cap filter, you name it.
Thanks again for the pointer I will check it out now!
Could be the cloudy weather here in Houston today fogging my brain…
Forum: Developing with WordPress
In reply to: show first 3 thumbnails of posts in different sizesTheme Handbook is a great place to start. Also learning PHP is important for this task you are working on.
Forum: Fixing WordPress
In reply to: wp-cron behaviour when there are multiple queued tasksI believe everything needing to run should run on a single page load or whatever method your using to kick it off.
Forum: Fixing WordPress
In reply to: Problem with announceAre you referring to the length of the excerpt?
If so have you considered the excerpt_length filter?
Also if this is the case you can use get_the_excerpt instead of the content.
Forum: Fixing WordPress
In reply to: create modulesThe way I learned the WordPress way is by installing WordPress with a default theme like 2016, 2015, 2017, one of those and then learn to create a child-theme. Modify a template file. Create a new template file and get it to work.
https://codex.www.ads-software.com/Child_Themes
Learn the template hierarchy:
https://developer.www.ads-software.com/themes/basics/template-hierarchy/
Have fun!
Forum: Fixing WordPress
In reply to: Removing proudly powered by in footerI’m not familiar with that particular theme but look in similar template files as in footer.php or template-parts/footer/site-info.php
Awesome, @mountainguy2 & @wfalaa thank you so much.
Busy this week with clients and haven’t had time to look into it at all.
If I go to wp-admin I get 404 page not found because I’m not logged in. It redirects to wp-login which is gone.
I’m not concerned about hiding the login I deleted it since I hardly ever log in to that site anyway.
My main curiosity is WordFence still emailing me about login attempts when there is no way to log in as far as I know.
I’ve done that in the past to hide the login but I’m not even concerned about logging in, it’s not a site I log in to very often so that’s why I just renamed the file with random string. I’ll just delete it for now and see what that does.
I’m wondering how I’m still getting WordFence emails about failed login attempts if they can’t even find the login file?
Forum: Developing with WordPress
In reply to: wp_remote_post & Authorization headerOh WOW!
Thanks Chris,Adding:
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
to the .htaccess solved my test setup.
Greatly appreciated!
Forum: Developing with WordPress
In reply to: Convert cURL to wp_remote_postDid you resolve this? I’m having some issue now with wp_remote_post with the added headers not being sent.
Forum: Fixing WordPress
In reply to: Add New Uploaded Plugin creating a file called \The only other difference is the original install was a 4.8.x tar file I had laying around and this time I downloaded latest as opposed to installing what I had then updating.