Plugin Directory

Changeset 2489776


Ignore:
Timestamp:
03/08/2021 05:21:01 PM (4 years ago)
Author:
gfirem
Message:

Release 1.3.3

Location:
buddyforms-hook-fields
Files:
57 added
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • buddyforms-hook-fields/trunk/buddyforms-hook-fields.php

    r2411886 r2489776  
    88 * Plugin URI: https://themekraft.com/products/buddyforms-hook-fields/
    99 * Description: BuddyForms Hook Fields
    10  * Version: 1.3.2
     10 * Version: 1.3.3
    1111 * Author: ThemeKraft
    1212 * Author URI: https://themekraft.com/buddyforms/
  • buddyforms-hook-fields/trunk/composer.json

    r2411886 r2489776  
    2121    "consolidation/robo": "^1.0.0",
    2222    "bamarni/composer-bin-plugin": "dev-master"
    23   },
    24   "require-dev": {
    25     "phpunit/phpunit": "^6.1",
    26     "php-coveralls/php-coveralls": "^2.0@dev",
    27     "squizlabs/php_codesniffer": "3.*",
    28     "friendsofphp/php-cs-fixer": "^2.9",
    29     "jakub-onderka/php-parallel-lint": "dev-master",
    30     "jakub-onderka/php-console-highlighter": "dev-master",
    31     "wp-coding-standards/wpcs": "dev-master",
    32     "symplify/easy-coding-standard": "^5.2@dev",
    33     "brainmaestro/composer-git-hooks": "dev-master"
    34   },
    35   "scripts": {
    36     "package": "sh .tk/package.sh buddyforms-hook-fields",
    37     "wp-release": "sh .tk/wp_release.sh",
    38     "beta-release": "sh .tk/full-deploy.sh buddyforms-hook-fields 412 false beta",
    39     "full-release": "sh .tk/full-deploy.sh buddyforms-hook-fields 412 false released",
    40     "update-freemius": "sh .tk/update-freemius.sh ../wordpress-sdk includes/resources/freemius"
    4123  }
    4224}
  • buddyforms-hook-fields/trunk/includes/form-options.php

    r2411886 r2489776  
    115115    ) );
    116116
     117    if ( $field_type === 'upload' || $field_type === 'file' ) {
     118
     119        $sizes = wp_get_registered_image_subsizes();
     120        $sizes = array_keys( $sizes );
     121
     122        $selected_size = false;
     123        if ( isset( $buddyform['form_fields'][$field_id]['thumbnail_size'] ) ) {
     124            $selected_size = $buddyform['form_fields'][$field_id]['thumbnail_size'];
     125        }
     126
     127        $form_fields['hooks']['thumbnail_size'] = new Element_Select( "Thumbnail size", "buddyforms_options[form_fields][" . $field_id . "][thumbnail_size]", $sizes, array(
     128            'value' => $selected_size,
     129            'shortDesc' => __( 'This option give the ability to control the size for uploaded images, Eg: thumbnail, medium, large.', 'buddyforms' ),
     130        ) );
     131
     132    }
     133
    117134    $form_fields['hooks']['html_display_end'] = new Element_HTML( '</div>' );
    118135
  • buddyforms-hook-fields/trunk/includes/list-all-post-fields.php

    r2411886 r2489776  
    3333
    3434    $add_table_content        = ( ! empty( $buddyforms[ $form_slug ]['hook_fields_list_on_single'] ) ) ? $buddyforms[ $form_slug ]['hook_fields_list_on_single'] : '';
    35     $post_template_id         = ( ! empty( $buddyforms[ $form_slug ]['hook_fields_template_page'] ) ) ? $buddyforms[ $form_slug ]['hook_fields_template_page'] : 'none';
     35    $post_template_id         = ( ! empty( $buddyforms[ $form_slug ]['hook_fields_template_page'] ) ) ? (int) $buddyforms[ $form_slug ]['hook_fields_template_page'] : 'none';
    3636    $is_post_template_enabled = ( ! empty( $post_template_id ) && $post_template_id !== 'none' );
    3737
     
    8080
    8181                if ( isset( $field['slug'] ) ) {
    82                     if($field['type']==='upload'){
    83                         $upload_field_val = get_post_meta($post->ID,$field['name'],true);
    84                         $media_items = explode(',', $upload_field_val);
     82                    if ( $field['type'] === 'upload' || $field['type'] === 'file' ){
     83                        $upload_field_val = get_post_meta( $post->ID, $field['slug'] , true);
     84                        $media_items = explode( ',', $upload_field_val );
    8585                        $result = "";
    86                         foreach ($media_items as $attachment_item){
    87                             $attachment_full_url = wp_get_attachment_url($attachment_item);
    88                             $default_thumbnail = plugin_dir_url(__FILE__).'/assets/images/multimedia.png';
    89                             $attachment_thumbnail_url = wp_get_attachment_thumb_url( $attachment_item) === false? $default_thumbnail : wp_get_attachment_thumb_url( $attachment_item);
    90                             $result .= "<a href='".$attachment_full_url."' target='_blank'> <img src='".$attachment_thumbnail_url."' /></a>" ."," ;
     86                        foreach ( $media_items as $attachment_item ){
     87                            $attachment_full_url      = wp_get_attachment_url( $attachment_item );
     88                            $default_thumbnail        = plugin_dir_url (__FILE__ ).'/assets/images/multimedia.png';
     89                            $attachment_thumbnail_url = wp_get_attachment_thumb_url( $attachment_item ) === false ? $default_thumbnail : wp_get_attachment_thumb_url( $attachment_item );
     90                           
     91                            $result .= "<a href='".$attachment_full_url."' target='_blank'> <img src='" . $attachment_thumbnail_url . "' /></a>";
    9192                        }
    92                         $new_content .= "<tr " . $striped . "><td><strong>" . $field['name'] . "</strong> </td><td>" .trim($result,','). "</td></tr>";
     93                        $new_content .= "<tr " . $striped . "><td><strong>" . $field['name'] . "</strong> </td><td>" .trim( $result ). "</td></tr>";
    9394                    }
    9495                    else{
     
    150151    $after_the_content  = false;
    151152
    152     foreach ( $buddyforms[ $form_slug ]['form_fields'] as $key => $customfield ) {
     153    foreach ( $buddyforms[ $form_slug ]['form_fields'] as $field_id => $customfield ) {
    153154
    154155        if ( ! empty( $customfield['slug'] ) && ( ! empty( $customfield['hook'] ) || is_single() ) ) {
     
    163164                    $post_meta_tmp .= '<label>' . $customfield['name'] . '</label>';
    164165                }
    165                 /// here
    166                 if($field['type']==='upload'){
    167                     $upload_field_val = get_post_meta($post->ID,$field['name'],true);
    168                     $media_items = explode(',', $upload_field_val);
    169                     $result = array();
    170                     foreach ($media_items as $attachment_item){
    171                         $attachment_full_url = wp_get_attachment_url($attachment_item);
    172                         $default_thumbnail = plugin_dir_url(__FILE__).'/assets/images/multimedia.png';
    173                         $attachment_thumbnail_url = wp_get_attachment_thumb_url( $attachment_item) === false? $default_thumbnail : wp_get_attachment_thumb_url( $attachment_item);
    174                         $result[]= "<a href='".$attachment_full_url."' target='_blank'> <img src='".$attachment_thumbnail_url."' /></a>";
     166
     167                if ( $field['type'] === 'upload' || $field['type'] === 'file' ){
     168                    $upload_field_val = get_post_meta( $post->ID, $field['slug'], true );
     169                    $media_items      = explode( ',', $upload_field_val );
     170                    $result           = array();
     171                    $thumbnail_size   = 'thumbnail';
     172
     173                    if ( isset( $buddyforms[ $form_slug ]['form_fields'][$field_id]['thumbnail_size'] ) ) {
     174                        $thumbnail_size = $buddyforms[ $form_slug ]['form_fields'][$field_id]['thumbnail_size'];
     175                    }
     176
     177                    foreach ( $media_items as $attachment_item ){
     178                        $attachment_full_url      = wp_get_attachment_url( $attachment_item );
     179                        $attachment_thumbnail_url = wp_get_attachment_image_src( $attachment_item, $thumbnail_size );
     180
     181                        if ( ! $attachment_thumbnail_url  ) {
     182                            $attachment_thumbnail_url = array( plugin_dir_url( __FILE__ ) . '/assets/images/multimedia.png' );
     183                        }
     184
     185                        $result[] = "<a href='".$attachment_full_url."' target='_blank'> <img src='" . $attachment_thumbnail_url[0] . "' /></a>";
    175186                    }
    176                     $meta_tmp = "<p>" . implode( ',', $result ) . "</p>";
    177                 }
    178                 else{
     187                    $meta_tmp = implode( '', $result );
     188
     189                } else{
    179190                    if ( is_array( $customfield_value ) ) {
    180191                        $meta_tmp = "<p>" . implode( ',', $customfield_value ) . "</p>";
     
    252263
    253264            add_filter( 'the_content', function ( $content ) use ( $after_the_content ) {
    254                 $query   = get_post( get_the_ID() );
    255                 $result  = $query->post_content . $after_the_content;
    256                 $content = str_replace( $query->post_content, $result, $content );
    257 
    258                 return $content;
     265                return $content . $after_the_content;
    259266            }, 9999 );
    260267        }
  • buddyforms-hook-fields/trunk/readme.txt

    r2411886 r2489776  
    33Tags: buddypress, user, members, profiles, custom post types, taxonomy, frontend posting, frontend editing,hook fields, custom fields, post meta
    44Requires at least: 3.9
    5 Tested up to: 5.5.3
    6 Stable tag: 1.3.2
     5Tested up to: 5.6.2
     6Stable tag: 1.3.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    6262
    6363== Changelog ==
     64= 1.3.3 - 8 Mar 2021 =
     65* Fixed issue related with hooked fields on the single view list.
     66* Added improvements on the integration of Upload and File fields.
     67* Tested up 5.6.2
     68
    6469= 1.3.2 - 2 Nov 2020 =
    6570* Fixed: Show upload field value.
Note: See TracChangeset for help on using the changeset viewer.