Forum Replies Created

Viewing 15 replies - 16 through 30 (of 31 total)
  • Thread Starter neosan

    (@nreljed)

    Hi Jory in fact I found the code to reproduce ACF Library
    I now use it on several sites it works well on all solutions.
    I just tested with the latest version of pods too, it works very well as you can see here
    demo snippet

    the code

    add_filter( 'ajax_query_attachments_args', 'filter_query_attachments_args' );
    
    function filter_query_attachments_args( $query ) {
    	// 1. Only users with access
    	if ( ! current_user_can( 'upload_files' ) ) {
    		wp_send_json_error();
    	}
    
    	// 2. No manipulation for admins.
    	// After all they have access to all images.
    	//if ( current_user_can( 'administrator' ) ) {
    		//return $query;
    	//}
    
    	// 3. No images, if the post_id is not provided
    	if ( ! isset( $_REQUEST['post_id'] ) ) {
    		wp_send_json_error();
    	}
    
    	// 4. No images, if you are not the post type manager or author
    	$post = get_post( (int) $_REQUEST['post_id'] );
    	if ( ! $post instanceof WP_Post ) {
    		return $query;
    	}
    
    	// 5. You can also restrict the changes to your custom post type
    	// Only filter for our custom post types
        if ( 'post' != $post->post_type) {
             return $query;
        }
    	
    	// 8. Don't show private images
    	$query['post_status'] = 'inherit';
    
    	// 9. Filter to display only the images attached to the post
    	$query['post_parent'] = $post->ID;
    
    	// 10. Filter to display only the user uploaded image
    	$query['editor'] = $current_user->ID;
    
    	return $query;
    }

    to add several CPTs I do like this
    if ( 'property' != $post->post_type && 'testimonial' != $post->post_type && 'logo' != $post->post_type && 'post' != $post ->post_type)

    but the base idea is to integrate this option in pods > gallery field (like ACF) in this way you just have to check it and the targeted File/Image/ Video field only displays the uploads attached to it

    I hope this little demonstration will convince you to add this scenario,
    if not, maybe ask the community and the people involved behind pods to discuss about this

    now i need to figure out how to make the first image in gallery field be the featured image of the post
    but maybe the community has the solution

    it will be interesting to do it directly with an option too because in my case the featured image of the post is included in the gallery
    it could simply be in the form of a ticking star

    • This reply was modified 2 years, 6 months ago by neosan.
    • This reply was modified 2 years, 6 months ago by neosan.
    Thread Starter neosan

    (@nreljed)

    thank you @rizaardiyanto
    for the answers and the help provided ??but this is not the right solution
    there is a real display bug ??
    to show you clearly I reinstalled role editor pro,
    basically I gave up role editor for publishpress capabilities,
    it’s unfortunate to have to reinstall it for that but it’s for science and to show you the bug ?????

    ok so I’m redoing the manipulation to hide my taxonomies for the “editor” role
    look at the pictures to see what bug I’m talking about

    manipulation with role editor pro

    manipulation with Publishpress capabilities 2.5

    you can clearly see the bug ?? they are still there in the options.

    it’s unfortunate to have to do more manipulation to hide them isn’t it?
    hopefully it will be fixed soon ??

    Thread Starter neosan

    (@nreljed)

    post updated to report a small bug related to version 2.5

    Thread Starter neosan

    (@nreljed)

    Thank you for your work and this update.
    I just installed version 2.5 and launched my series of tests on my current installation and a fresh one to confirm.

    everything seems to be working fine except for an annoying detail that shouldn’t exist

    the taxonomy boxes are well hidden but in “Screen Options” they are still there and they are still checked which is confusing

    I could hide “Screen Options” but I need to leave it for the client on some functions.

    it’s a detail that I didn’t have with role editor pro it must be missing an instruction to hide them completely in “Screen Options”.

    I also accidentally discovered this Disable Gutenberg 2.7 plugin
    it does exactly the same thing by disabling Gutenberg but with another dimension and finer controls

    but publishpress capabilities does not detect it the actions are without any effect.

    at the moment I don’t need this, but I imagine someone will come forward and point this out

    700,000+ installs just for that? it is not negligible

    so maybe improve the code to detect this one too and of course make sure that nothing is displayed in “Screen Options”

    in another alternative vision if I was a developer on publishpress capabilities I will think about integrating this notion of disabling Gutenberg with fine controls since it seems that the demand is enormous
    + the advantages already offered by your plugins to customize wordpress

    thank you for everything

    Thread Starter neosan

    (@nreljed)

    thanks @olatechpro
    for your time and your response

    it’s true that my snippet exposes an interesting scenario or sometimes we need the classic editor for some CPTs and not all

    for example I use jetformbuilder where it only works with gutenberg, installing classic editor plugin leads me to another more unpleasant scenario where gutenberg is disabled everywhere which is not desired.

    PublishPress Capabilities should be able to detect this scenario

    and maybe why not integrate this possibility directly into its settings choose whether or not to disable Gutenberg for CPTs

    Thread Starter neosan

    (@nreljed)

    hello,
    at the end of my first post I included the snippet that I use to deactivate Gutenberg which puts the classic editor back by default,

    you just have to put the name for the desired CPT and voila
    I don’t use any plugin to put classic editor back

    you can just test it with posts and find that PublishPress Capabilities no longer has any effect in “Editor Feature Restriction”

    add_filter('use_block_editor_for_post_type', 'prefix_disable_gutenberg', 10, 2);
    function prefix_disable_gutenberg($current_status, $post_type)
    {
        // Use your post type name
    	if ($post_type === 'post') return false;
        return $current_status;
    }
    Thread Starter neosan

    (@nreljed)

    thank you for your reactivity problem solved

    Thread Starter neosan

    (@nreljed)

    hello @annaszalkiewicz ,

    I already mentioned it ??

    I use jetengine powerful all in one solution (homepage form-builder). to create CPTs and forms and profile builder.
    your plugin works in the backend but it doesn’t understand what is happening in the frontend. this is surely the case with any frontend form.

    I use the sending posts by registered users
    here is a demo
    https://demo.crocoblock.com/cardealer/
    click on “+ place an ad”
    login: demo pass: demo
    click “Add new car”
    we are in the form
    that’s what it does if users Upload Images to Gallery
    nothing happens the images remains without watermak.

    • This reply was modified 3 years, 9 months ago by neosan.
    • This reply was modified 3 years, 9 months ago by neosan.
    Thread Starter neosan

    (@nreljed)

    yes, indeed I am always looking for better plugins to customize wordpress menus, hide and define what should be seen or not. Among all the plugins that I have tested commercial or free. you are the only one to meet that. It might sound crazy, right?

    let me show you what I consider to be perfect.
    we will start from my personal experience to understand why despite White Label CMS I still have to install another plugin which is very very annoying because one of the two will be enough if ..

    – Global option to hide items by roles
    – Hide metaboxes
    – Hide admin or roles accounts
    – Hide elements in backend by CSS

    I think, not even think, these elements together will be a must. all to unite in a single plugin to rule them all.

    I avoided the roles part, because Menu Editor Pro saves me from installing another plugin for that! but i believe if you have sufficient programming skills you could see how to add this.

    I hope it was quite clear and explained ??

    CMS White Label new gen

    comparison of titans

    neosan

    (@nreljed)

    thank you for reassuring us, so if I understood correctly I do not watermark my local site, I wait I put it online then I apply the watermark in bulk. is not it ? it’s a good idea, isn’t it? while waiting for a more internal trick to be found

    neosan

    (@nreljed)

    I am now worried.. ?? about what this person said. i will check it too ..
    are we exposed to security risks?
    should we expect secondary consequences?

    Thread Starter neosan

    (@nreljed)

    Hello joy,
    thank you for taking the time to answer me,

    I carried out tests the code works well even with similar post titles everything works as I want,
    I just noticed that when you post an untitled post it does auto draft titles everywhere ..
    interesting maybe I should put the title as required. but this is not the main problem

    same post titles -test passed ok

    I am not an expert in development, php I try to avoid and at the same time to learn as much as possible, it is inevitable.

    just to respond to your advice to refer me again to the plugins,
    it’s been a year since I started using wordpress, I already have a site that uses plugins to do the job, what I want today is something more specific like snippets to get rid of the plugins and the surplus of scripts etc … I hope this is understandable?

    it were impossible I wouldn’t even be there. I am here only to solicit the help of php experts and learn how to use very precise and simple code snippets. I am surprised not to have more posts where is the community?

    ps: I have already used and asked for help.
    nothing has changed despite marked resolved
    So you think I should give up and wait for someone to do it for me or encourage me to learn how to do it? everything needs a starting point, right?

    now let’s forget about image sizes I know exactly what sizes I need.

    let’s try to focus on how to secure and specify that the code should only execute in the post type ‘property’
    to move forward I did a google search, I tried to add this

    if (is_singular ('property')) {
    
    if ($ post_id = array_key_exists ("post_id", $ _POST)? $ _POST ["post_id"]: null) {
    if ($ post = get_post ($ post_id)) {
    return $ post-> post_title. $ ext;
    }
    }
    
    }

    it doesn’t work, I misunderstood something..I will continue my research.

    now following your remark what is not secure ( $_REQUEST) ? and what line of code should be added? we have to progress somewhere.

    if you know someone who can make it safe and respectful of wordpress standards please show them this post .

    Thread Starter neosan

    (@nreljed)

    Yes it’s perfect it suits me ??
    I hope it’s not very difficult to implement

    Thread Starter neosan

    (@nreljed)

    Hello again,
    to explain the reason for this need,
    I created a real estate site, each post is a property and each image is unique and related to its property. therefore the user does not need to see the other images of the other properties.
    There is nothing interesting to add it will be total confusion..

    He only needs to see the attached images and add new images

    I Hope it was clear and it makes sense to you

    Thread Starter neosan

    (@nreljed)

    Hello ,
    no I have no link. I’m still working locally with xampp.
    it’s very simple to reproduce, just do a clean install wordpress 5.4 and install blocksy theme + Blocksy Companion then import a modern shop starter site, go to the shop page see what it looks like (pagination), then install your plugin, then go and see again the shop page. now the second bug try to create a simple categories filter.

    • This reply was modified 4 years, 11 months ago by neosan.
Viewing 15 replies - 16 through 30 (of 31 total)