• Resolved gaustin100

    (@gaustin100)


    Hi: I manage a multitenancy site and need to be able to set price based on the user’s WordPress Group (we use the Group plugin, which provides wp_group tables that identify each user’s group. I see you offer price by user role – could you substitute user group?? This would be extremely helpful and we would be willing to contribute to support dev of this feature. Pls let me know!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author algol.plus

    (@algolplus)

    hi

    this plugin – https://wordpress.org/plugins/groups/ , correct ?
    thanks, Alex

    Plugin Author algol.plus

    (@algolplus)

    Hello

    We were able to add Groups to role filters.

    Please, contact me via helpdesk to get beta.

    Plugin Author algol.plus

    (@algolplus)

    New filters were added in version 1.6.0.

    so , please, try this code

    function wdp_get_all_groups_list() {
    	$groups = array();
    	if ( function_exists( '_groups_get_tablename' ) ) {
    		global $wpdb;
    		$groups_table = _groups_get_tablename( 'group' );
    		$groups = $wpdb->get_results( "SELECT * FROM $groups_table ORDER BY name" );
    	}
    	return is_array( $groups ) ? $groups : array();
    }
    
    add_filter( 'wdp_preloaded_list_user_roles', function ( $list ) {
    	foreach ( wdp_get_all_groups_list() as $group ) {
    		$list[] = array(
    		'id' => '(group)' . strtolower( $group->name ),
    		'text' => '(group) ' . $group->name,
    		);
    	}
    	return $list;
    } );
    
    add_filter( 'wdp_current_user_roles', function ( $roles ) {
    	foreach ( wdp_get_all_groups_list() as $group ) {
    		$roles[] = '(group)' . strtolower( $group->name );
    	}
    	return $roles;
    } );
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Need Price by Group (WP plugin field)’ is closed to new replies.