pheonixgh
Forum Replies Created
-
Forum: Plugins
In reply to: [File Gallery] [Plugin: File Gallery] WP 3.5 ?submitted a pull request for my duplicate filtering with an added visual indicator on attached items.
pull request
my forkForum: Plugins
In reply to: [File Gallery] [Plugin: File Gallery] WP 3.5 ?i have been working on a solution for the attachment issue and am making progress, in the meantime inserting the following in your themes function file should remove all the FG duplicates from the new insert dialog.
remove_action( 'wp_ajax_query-attachments', 'wp_ajax_query_attachments', 1 ); add_action( 'wp_ajax_query-attachments', 'my_ajax_query_attachments', 1 ); $attach_parent = null; function my_ajax_query_attachments(){ global $attach_parent; $query = isset( $_REQUEST['query'] ) ? (array) $_REQUEST['query'] : array(); $query = array_intersect_key( $query, array_flip( array( 's', 'order', 'orderby', 'posts_per_page', 'paged', 'post_mime_type', 'post_parent', 'post__in', 'post__not_in', ) ) ); $query['post_type'] = 'attachment'; $query['post_status'] = 'inherit'; if ( current_user_can( get_post_type_object( 'attachment' )->cap->read_private_posts ) ) $query['post_status'] .= ',private'; $attach_parent = $_REQUEST['post_id']; add_filter('posts_where', 'filter_duplicate_attachments'); $query = new WP_Query( $query ); remove_filter('posts_where', 'filter_duplicate_attachments'); $attach_parent = null; //error_log(print_r($query,true)); $posts = array_map( 'wp_prepare_attachment_for_js', $query->posts ); $posts = array_filter( $posts ); wp_send_json_success( $posts ); } function filter_duplicate_attachments($input) { global $post, $attach_parent; if (!empty($attach_parent)){ $input .= " AND ((wp_posts.ID NOT IN ( SELECT ID FROM wp_posts AS ps INNER JOIN wp_postmeta AS pm ON pm.post_id = ps.ID WHERE pm.meta_key = '_is_copy_of' )) OR (wp_posts.post_parent=". $attach_parent ."))"; } return $input; }
hope this helps some of you.
Forum: Plugins
In reply to: [CMS Tree Page View] Feature Request : Permissions filtersThanks for the update, looks good, two things however,
i would recommend you have the default permission value for the two “add” functions default to the
$post_type_object->cap->create_posts
capability rather than the edit post, as per my last post. as it will then be a bit more likely to work out of the box with any permission changes that may have been made. Its not the end of the world as the filter lets me override when i need to anyway but it would make sense to check the more relevant permission.secondly i would suggest adding the same user_can_add_xxx permission check and filter calls to the ajax function that does the actual adding as otherwise it is possible for any logged-in user to call this function and add pages regardless of their permissions. So whilst you hide the buttons its a bit of a security hole.
lastly is there any chance you could add the same functionality to your
“Admin Menu Tree Page View” plugin.Forum: Plugins
In reply to: [CMS Tree Page View] Feature Request : Permissions filtersHeya, sorry for the delayed response.
Role Scoper is a very powerful plugin with many different ways to configure things to achieve similar results. I think trying to support it directly would be extremely difficult as it would be highly dependent on each individuals needs and their Role Scoper configuration.my advise would be to go for something like
$can_edit = apply_filters("cms_tree_page_view_can_edit",current_user_can( $post_type_object->cap->edit_post, $page_id), $page_id);
for can_edit, the current_user_can call will be caught by RS automatically and it custom post type friendly, and the new filter would let you add any additional checking if required.
the bits that i need are something like:
$can_add_after = apply_filters("cms_tree_page_view_can_add_after", current_user_can( $post_type_object->cap->create_posts), $page_id); $can_add_inside = apply_filters("cms_tree_page_view_can_add_inside", current_user_can( $post_type_object->cap->create_posts), $page_id);
these check for basic publish permissions for the post type via current_user_can again this will be caught by RS which may be sufficient in many situations, if not the filters let you add some extra checking.
these filtered results can then be used to both control the display of the add links but also check for correct permissions in the ajax function.
hope that makes sense. :S
Forum: Plugins
In reply to: [Relevanssi - A Better Search] Feature Request: Percentage scoreThanks for the response, i was aware of the relevance_score attribute but this unfortunately this doesn’t help with my particular goal if results are paginated, since beyond the first page the posts collection no longer contains the first/top post and its score.
i am happy to calculate it myself, but having access to the full results data via the filter would be helpful and would save re-querying or some other hack to retrieve/store the top result.I planned to use it show a colour graduated “strength” bar rather than show a percentage directly. This would make differences in score within a result set more meaningful and intuitive, as a “good” score can be quite arbitrary and differ considerable between searches depending on terms/hits. the top result is however always the “best available” match even if it isn’t as you quite rightly say 100% relevant. a percentage scale would make quality between results more apparent i think.
Forum: Plugins
In reply to: [File Gallery] [Plugin: File Gallery] WP 3.5 ?I would love to see 3.5 support and have some ideas on this front.
I am not experiencing the issues described above using RC3.
the new media modals are great in many ways but i am already missing the features file gallery brought to the table whilst using the current RC.
the ‘attach all checked to post’ functionality, duplicate filtering etc.
have been having a nose at the new Backbone setup, and whilst not familiar with these libraries they look to be fairly extensible.
would love to help with development if can either with code contribution or just beta-testing. Let me know if i can help support this great plugin.ahah i had overlooked the
yarpp_support
for custom post types, that solves that bit.
Though would be great if this were available as a list of types with checkboxes. it may not always be possible or desirable to alter post type definitions.
As for the weights i wanted to have three tiers for body,title and category whilst also requiring a category match, from what i can see, via the settings screen, making a taxonomy required will always set its weight to 1, and you can only really have 2 weights (1 andYARPP_EXTRA_WEIGHT
).
the ability to define numerical weights directly, with a numerical required value for each taxonomy, on the setting page would be more flexible.either way i have now achieved what i wanted by altering my weights as required via the
yarpp_settings_save
filter (much better than having to do it before each call).
thus i can utilize your existing and elegant table caching system.
thanks for all your assistance and a great plugin.@mitcho: thanks for the response. Sorry if my post was confusing.
yes i am looking for a programmatic way to alter some of the default options not available via the settings page, such that my yarpp results are still cached.
I want to add an additional post type and change the weighting for all yarpp use throughout the site. these options are not fully configurable via the settings page.
i know it is possible to achieve the correct results using an appropriate args array, but the results of these calls are not cached as the settings do not match the defaults.
thus the only way i found to achieve this was merge my custom options with the ‘yarpp’ option prior to each function call.
i am well aware that this is not advisable hence my post.
a filter on theget_option()
output which is also passed the $option param, within class-core.php would suffice, however this would/could then effectively contradict the settings page.glad i could help re the stopwords.
Forum: Plugins
In reply to: [File Gallery] [Plugin: File Gallery] Files not actually deletedAll seems to be working well, code looks cleaner too, nice work.
loving the new gallery class option makes my css a little cleaner!
a major improvement for me would be improved mime type/file type detection and custom icon usage, i use this in an intranet setting and would love to be able to define custom file icon associations.
i currently do it for the front end using a template with code derived from the way the “postie” plugin handles attachments using a combination of mime and file extension and some predefined lists.
i dont want to have to modify your plugin code though and there isnt a filter/template option in all the places these thumbs are generated on the admin side. ??Alternatively and perhaps less work and ultimately more flexible/extensible would be to append mime and file extension strings as additional classes to the image/link tags so it could be handled by css.
keep up the good work.
regards
Greg
register your post type and define the capability list for it as below.
These capabilities will then appear in the capability manager interface.
NOTE THE META CAPABILITIES SHOULD NOT BE ASSIGNED SEE BELOW FOR THE CODE TO HANDLE THOSE.[Moderator note: snipped code block, please use the pastebin as per the Forum Guidelines]
This code will fix the meta capabilities to work with your custom post type.
[Moderator note: snipped code block, please use the pastebin as per the Forum Guidelines]
hope that helps! ??