Plugin Directory

Changeset 3362107


Ignore:
Timestamp:
09/16/2025 12:01:38 AM (4 months ago)
Author:
shadialaghbari
Message:

1.2.2

Location:
musahimoun
Files:
97 added
7 edited

Legend:

Unmodified
Added
Removed
  • musahimoun/trunk/README.txt

    r3362016 r3362107  
    55Requires at least: 6.4
    66Tested up to: 6.8
    7 Stable tag: 1.2.1
     7Stable tag: 1.2.2
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    4646= 1.2.1 (2025-09-15) =
    4747* Fix fatal error.
     48= 1.2.1 (2025-09-15) =
     49* Fix fatal error.
    4850= Modify the foreign key constraint on database.
    4951
  • musahimoun/trunk/docs/DEVELOPER.md

    r3361978 r3362107  
    108108    1. Navigate to the `front/` directory.
    109109    2. Run `npm install` to install dependencies.
    110     3. Run `npm run build` to generate assets for both development and production modes.
     110    3. Run `npm run dev` to generate assets for development.
     111    3. Run `npm run build` to generate assets production.
    111112
    112113### Packaging (`package-plugin.ps1`)
  • musahimoun/trunk/front/package.json

    r3359412 r3362107  
    1313        "lint:pkg-json": "wp-scripts lint-pkg-json",
    1414        "packages-update": "wp-scripts packages-update",
    15         "dev": "wp-scripts start",
    1615        "test:e2e": "wp-scripts test-e2e",
    1716        "test:unit": "wp-scripts test-unit-js",
    1817        "test": "echo \"Error: no test specified\" && exit 1",
    19         "start": "webpack-dev-server --open --config webpack.config.js",
    20         "build": "webpack --watch --config webpack.config.js"
     18        "dev": "webpack --watch --mode development --config webpack.config.js",
     19        "build": "webpack --watch --mode production --config webpack.config.js"
    2120    },
    2221    "author": "Shadi Gaafar",
  • musahimoun/trunk/inc/class-contributor-service.php

    r3361978 r3362107  
    115115            }
    116116           
    117             // Query users and guests using the limited ID after it has been sorted by ids.
    118             $user_query = new \WP_User_Query( $user_args );
    119             $users      = ! empty( $user_query->get_results() ) ? $this->format_users( $user_query->get_results(), $output ) : array();
     117            $users = array();
     118
     119            //check if include is set and not empty after filtering. Important for not getting all users if no match.
     120            if ( isset( $user_args['include'] ) && ! empty($this->filter_user_ids( $user_args['include'] )) ) {
     121                $user_query = new \WP_User_Query( $user_args );
     122                $users      = ! empty( $user_query->get_results() ) ? $this->format_users( $user_query->get_results(), $output ) : array();
     123            }
    120124
    121125            $guest_service = new Guest_Service( $guest_args, ARRAY_A );
  • musahimoun/trunk/inc/class-mshmn-contributor.php

    r3361978 r3362107  
    233233                            array(
    234234                                'key'     => MSHMN_POST_CONTRIBUTORS_META,
    235                                 'value'   => '[[:<:]]' . $this->contributor->id . '[[:>:]]',
     235                                'value'   => '(^|,)' . $this->contributor->id . '(,|$)',
    236236                                'compare' => 'REGEXP',
    237237                            ),
     
    239239                    );
    240240                } elseif ( $query->is_author() ) {
    241                     $user_id = get_user_by( 'slug', $author_nicename )->ID;
    242 
     241                    $user_id = get_user_by( 'slug', $author_nicename )->ID ?? 0;
     242
     243                    highlight_array( $user_id, 'user_id' );
    243244                    // this step is important, cos some users can be assigned as an author by this plugin,
    244245                    // and the don't actually has posts, so they don't have author archive.
    245246                    $this->contributor = (object) get_contributors( array( 'include' => $user_id ) )[0];
     247
     248                    highlight_array( $user_id, 'user_id' , $this->contributor);
    246249                    $query->set( 'author', false );
    247250                    $query->set(
     
    250253                            array(
    251254                                'key'     => MSHMN_POST_CONTRIBUTORS_META,
    252                                 'value'   => '[[:<:]]' . $this->contributor->id . '[[:>:]]',
     255                                'value'   => '(^|,)' . $this->contributor->id . '(,|$)',
    253256                                'compare' => 'REGEXP',
    254257                            ),
  • musahimoun/trunk/inc/functions.php

    r3362016 r3362107  
    4444 */
    4545function get_contributors( $args = array(), $output = OBJECT ): array {
    46     $contributor_service = new \MSHMN\Contributor_Service( $args, $output );
    47     return (array) $contributor_service->get_results();
     46    $contributor_service = new \MSHMN\Contributor_Service( $args );
     47    return (array) $contributor_service->get_results( $output);
    4848}
    4949
     
    9292
    9393        if ( ! empty( $role_assignment['contributors'] ) ) {
    94             $contributors_ids   = $role_assignment['contributors'];
    95             $contributors_query = new \MSHMN\Contributor_Service( array( 'include' => $contributors_ids ) );
    96             $contributors       = $contributors_query->get_results( ARRAY_A );
    97         }
    98 
    99         $role = $roles->get_roles( array( 'include' => array( $role_assignment['role'] ) ) )[0] ?? array();
     94            $contributors_ids   = (array) $role_assignment['contributors'];
     95            $contributors = get_contributors( array( 'include' => $contributors_ids ), ARRAY_A );
     96        }
     97
     98        $role = (array) $roles->get_roles( array( 'include' => array( $role_assignment['role'] ) ), ARRAY_A )[0] ?? array();
     99
    100100        $role_assignments_with_entites[ $key ]['role'] = array_merge(
    101101            $role,
    102102            array(
    103                 'icon' => ! empty( $role->icon ) ? wp_get_attachment_image_url( $role->icon, 'thumbnail', true ) : null,
     103                'icon' => ! empty( $role['icon'] ) ? wp_get_attachment_image_url( $role['icon'], 'thumbnail', true ) : null,
    104104            )
    105105        );
  • musahimoun/trunk/musahimoun.php

    r3362016 r3362107  
    44 * Plugin URI:
    55 * Description: This plugin allows you to choose an author, create a guest author or choose multiple authors and contributors..
    6  * Version: 1.2.1
     6 * Version: 1.2.2
    77 * Requires at least: 6.4
    88 * Requires PHP: 7.4
Note: See TracChangeset for help on using the changeset viewer.