Forum Replies Created

Viewing 15 replies - 1 through 15 (of 49 total)
  • Thread Starter magland

    (@magland)

    Not sure why this post is marked as resolved….

    The issue is not to do with the count.

    When you go to the add new download screen under the files/versions box (which should be empty because it’s a new download being added) it lists all other downloads in the system as versions of the new download.

    It is not restricted to only listing versions of that file it is showing ALL other files when adding a new download.

    Does that make sense?

    If I have temporarily fixed it by adding a true / false flag within that function to check if the file being added is new or not. If it is then it should not list any files in the files/versions box.

    Thread Starter magland

    (@magland)

                <div class="dlm-metaboxes downloadable_files">
    				<?php
    				$i        = - 1;
    				$versions = $download->get_versions();
    
    				if ( $versions ) {
    
    					/** @var DLM_Download_Version $version */
    					foreach ( $versions as $version ) {
    
    						$i ++;
    
    						download_monitor()->service( 'view_manager' )->display( 'meta-box/version', array(
    							'version_increment'   => $i,
    							'file_id'             => $version->get_id(),
    							'file_version'        => $version->get_version(),
    							'file_post_date'      => $version->get_date(),
    							'file_download_count' => $version->get_download_count(),
    							'file_urls'           => $version->get_mirrors(),
    							'version'             => $version,
    						) );
    
    					}
    				}
    				?>
                </div>

    The problem seems to be with this code in src/Admin/WritePanels.php

    When editing an existing download it works fine, when adding a new download the line of code ‘$versions = $download->get_versions();’ is an array of ALL downloads currently in the system. This means every time a d=new download is added all versions of all other files are added automatically.

    The function get_versions is flawed somewhere, possibly in get_version_ids but I can’t quite pick it apart.

    This makes the plugin unusable at the moment.

    Thread Starter magland

    (@magland)

    It was 4.4.4 but i’ve tried 4.4.2 and 4.2.0 and it remains the same.

    Thread Starter magland

    (@magland)

    Should also note the same issue occurs with the group documents extension.

    Upgrading from 4.9.10 to 5.0.0 breaks it. So I’d say it’s definitely a compatibility issue with WordPress 5.

    Thread Starter magland

    (@magland)

    I’ve just tested downgrading from 5.1.1 to 4.9.10 and it fixes the issue.

    Thread Starter magland

    (@magland)

    Just found that this code in my functions appears to work:

    add_filter( 'ass_clean_content', 'strip_shortcodes', 10 );

    If anyone has any better suggestions let me know.

    Ideally I’d like to remove the shortcode block from the email but leave the link / video or image in the email.

    This doesn’t work if you are an admin. Admin always sees all results. I’d like for admin to only see their results on the frontend same as everyone else.

    If admin needs to see other peoples results they can always view in the backend.

    The plugin https://www.ads-software.com/plugins/wp-user-groups/ allows associating terms(in the backend only) like rea l content term association and users can be searchable with it.

    Thanks for the recommendation but sadly this defeats the purpose of users being able to update their own profile from the frontend if it only works backend.

    For now I’ve made it work as follows:

    	/**
    	 * Filter display.
    	 *
    	 * @param mixed $field_value
    	 * @param string $field_id
    	 *
    	 * @return mixed
    	 */
    	public static function display_filter( $field_value, $field_id = '' ) {
    
    	    if ( empty( $field_value ) ) {
    			return;
    		}
    
    		$field_value = explode(',', $field_value );
    		$term_ids = wp_parse_id_list( $field_value );
    
    		$tax = self::get_selected_taxonomy( $field_id );
            $list = '';
    
    		foreach( $term_ids as $term_id ) {
    			$tid = trim($term_id);
    			$term = get_term( $term_id, $tax );
    			if ( ! $term || is_wp_error( $term ) ) {
    				continue;
    			}
    			$query_arg = bp_core_get_component_search_query_arg( 'members' );
    			$search_url = add_query_arg( array( $query_arg => urlencode( $tid ) ), bp_get_members_directory_permalink() );
    			$list .= sprintf( '<li><a href="%1$s">%2$s</a></li>', esc_url( $search_url ), esc_html( $term->name ) );
    
            }
    
    		if ( $list ) {
    			return '<ul class="bpxcftr-multi-taxonomy-terms-list">'.$list.'</ul>';
    		}
    
    		return '';
    	}

    It partially works even when passing the id as the search term. It returns correct results but alos results for anywhere else that number appears e.g. phone numbers.

    It’s clear to me this is also the desired behaviour as shown in the other site I linked to above.

    They obviously have a dog breeds post type and owners my own more than one breed.

    They want to be able to link this to a search of the members directory to find other owners of the same breed.

    It’s really quite simple, in my case I have two taxonomies that store terms for ‘interests’ and ‘skills’, and one post type that stores work locations. My members are able to select multiple terms from for example skills and have them display on their profile.

    The idea behind making them searchable is that they can then click the skill and find other members with the same skill or interest.

    Equally for post type they can click on the location or building name and find other members that also work there.

    Post types and taxonomies are ideal candidates for storing this info, Member types would not be suited in this instance. Neither would standard multiselect or checkboxes.

    Thank you for the reply, however I disagree.

    If auto link is disabled the values should display as text, not as links to the taxonomy archive. Alternatively this should be an option however the expected behaviour is just text.

    If autolink is enabled they should be searchable.

    While it may not be ideal in terms of search query performance the functionality exists in the backend to make them autolink therefore that functionality should be implemented on the front end. The plugin is not fully compatible with buddypress, not the other way around.

    Currently enabling autolink breaks the site by outputting escaped html.

    Doing a search for “bpxcftr-multi-taxonomy-terms-list” on Google brings back a single live site which demonstrates the issue…

    https://puppy.pics/members/yorkielife/profile/

    Dog Name: Zuzi

    The word ‘Zuzi’ is hyperlinked to: https://puppy.pics/members/?members_search=Zuzi

    The site obviously uses your plugin and the section for breed show the problem:

    Breed:
    <ul class='bpxcftr-multi-taxonomy-terms-list'><li><a href="https://puppy.pics/rt_dog-breeds/yorkshire-terrier/">Yorkshire Terrier</a></li></ul>

    This should be:

    Breed: Yorkshire Terrier

    hyperlinked to https://puppy.pics/members/?members_search=Yorkshire+Terrier

    Hope that makes sense!

    I have a related problem with the autolink functionality for Custom Taxonomy Multiselector and Custom Post Multiselector also.

    I would like the autolink to be enabled however this should perform a search of the members directory.

    Instead I get a broken html list printed to the screen.

    Looking at the ‘display_filter’ function in both classes (class-field-type-multi-select-taxonomy.php and class-field-type-multi-select-post-type.php) neither check to see if autolink is enabled or not and neither has any code to make the items a click through to a search query of the members directory.

    Code from the original plugin is as below:

            /**
             * Modify the appearance of value. Apply autolink if enabled.
             *
             * @param  string   $value      Original value of field
             * @param  int      $field_id   Id of field
             * @return string   Value formatted
             */
            public static function display_filter($field_value, $field_id = '') {
    
                $new_field_value = $field_value;
    
                if (!empty($field_value) && !empty($field_id)) {
                    $field = BP_XProfile_Field::get_instance($field_id);
                    if ($field) {
                        $do_autolink = apply_filters('bxcft_do_autolink',
                            $field->get_do_autolink());
                        if ($do_autolink) {
                            $query_arg = bp_core_get_component_search_query_arg( 'members' );
                        }
                        $childs = $field->get_children();
                        if (!empty($childs) && isset($childs[0])) {
                            $taxonomy_selected = $childs[0]->name;
                        }
                        $aux = '';
                        $term_ids = explode(',', $field_value);
                        foreach ($term_ids as $tid) {
                            $tid = trim($tid);
                            $term = get_term_by('name', $tid, $taxonomy_selected);
                            if ($term && $term->taxonomy == $taxonomy_selected) {
                                if (empty($aux)) {
                                    $aux .= '<ul class="list_custom_taxonomy">';
                                }
                                $aux .= '<li>';
                                if ($do_autolink) {
                                    $search_url = add_query_arg( array(
                                        $query_arg => urlencode( $tid )
                                    ), bp_get_members_directory_permalink() );
                                    $aux .= '<a href="' . esc_url( $search_url ) .
                                        '" rel="nofollow">' . $term->name . '</a>';
                                } else {
                                    $aux .= $term->name;
                                }
                                $aux .= '</li>';
                            }
                        }
                        if (!empty($aux)) {
                            $aux .= '</ul>';
                        }
                        $new_field_value = $aux;
                    }
                }
    
                /**
                 * bxcft_multiselect_custom_taxonomy_display_filter
                 *
                 * Use this filter to modify the appearance of Multiselector
                 * Custom Taxonomy field value.
                 * @param  $new_field_value Value of field
                 * @param  $field_id Id of field.
                 * @return  Filtered value of field.
                 */
                return apply_filters('bxcft_multiselect_custom_taxonomy_display_filter',
                    $new_field_value, $field_id);
            }

    what performance issues have you had? I’ve been running it on a site for 9 months and haven’t noticed any problems.

Viewing 15 replies - 1 through 15 (of 49 total)