• Resolved shara94

    (@shara94)


    Hello.

    I have 2 user roles.
    Teachers and Agents.

    When user Register as Teacher I have a logical questions.
    Do u offer also Agent service? – and user can select yes or no.

    Now, I have a 2 member directory created, teachers and agents
    and in Agent directory I want to show also teachers, who has selected agent service.

    how can I do it?

    Can I do it with php custom code?

    Thanks

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @shara94

    Have you tried selecting the roles in the “User Roles to Display” options? Please go to WP Admin > Ultimate Member > User Roles > Edit a Role > see “General Options” > see Roles in the “User Roles to Display”.

    Regards,

    Thread Starter shara94

    (@shara94)

    @champsupertramp
    Thanks for reply.

    I dont understand really what u mean.

    Where is General Option? see screenshots –

    https://prntscr.com/1zzcqh6
    https://prntscr.com/1zzctu6
    https://prntscr.com/1zzcur6
    https://prntscr.com/1zzcur6
    https://prntscr.com/1zzcvqm

    Maybe you don’t understand what I want.

    So, I can explain more better.

    I have 2 register form, first one is for teachers and second one is for agents.
    In teacher’s register form I have a question: Are you offer Agent Service?
    and Answers is yes or no.

    So, I have created 2 directory, for Teachers and for Agents.

    I would like in Agents directory to show also teachers, who has selected YES I OFFER AGENT SERVICE.

    I hope you understand.

    Thanks

    • This reply was modified 3 years, 3 months ago by shara94.
    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @shara94

    Sorry for the mixup. I gave you the wrong path. Please see the General Options in the WP Admin > Ultimate Member > Member Directories > edit a directory.

    You can set the admin filtering there to display users based on the filter value e.g. Offer Agency Service. You can also show the “Offer Agency Service” as a member directory search filter, see “Search Options” when you edit the Member Directory.

    Regards,

    Thread Starter shara94

    (@shara94)

    @champsupertramp
    I know what u mean, but no I don’t want it..
    in directory, if I select also teachers. Than shows all teachers. here is not any filter. to show only teachers, who has selected agent offer.

    https://prntscr.com/1zzetxq

    Thread Starter shara94

    (@shara94)

    I have found your code

    /**
     * Show users with a Job Title "'WP Plugin developer " only
     **/
    add_filter('um_prepare_user_query_args', 'um_my_custom_query_args', 99, 2); 
    function um_my_custom_query_args( $query_args, $args ) { 
    
    if( $args["form_id"] == "1" ) {  // you can validate  the current member directory form ID
    
         $query_args['meta_query'][] = array( 
                "relation" => "OR",
                array(
                    'key' => 'job_title', 
                    'value' => serialize( 'WP Plugin developer' ), 
                    'compare' => 'LIKE' 
               ),
              array(
                   'key' => 'job_title',
                   'value' => 'WP Plugin developer',
                  'compare' =>  '='
               )
         ); 
    
     } // endif
    
       return $query_args; 
    
    }

    This is what I want. but dont understand what is “relation” ?

    or ‘compare’ ?

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @shara94

    Relation relates to how the data in one table is related to the data in another table. Compare is Operator to test the ‘value’. Try changing the “WP Plugin developer” to your preferred search keyword and see if it works for you.

    Regards,

    Thread Starter shara94

    (@shara94)

    @champsupertramp

    Look, https://prntscr.com/1zztugx
    this is Field.

    This is code – https://prntscr.com/1zztwrq

    Result is nothing is found but on the website is a teacher who has Selected agent service ja.
    Screenshots: https://prntscr.com/1zztwrq

    https://prntscr.com/1zzu232

    and this is user profile – https://prntscr.com/1zzu3zn

    When I write code, all registred Agents also removed from Agent directory and nothing is show. but usually, some agents are registred.

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @shara94

    Could you please provide screenshots of the Member Directory settings? Please go to WP Admin > Ultimate Member > Member Directories > Edit a directory.

    Regards,

    Thread Starter shara94

    (@shara94)

    @champsupertramp

    Ahhh… I have selected teachers and now it work.

    THank you!

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Thanks for letting us know.

    Regards,

    Thread Starter shara94

    (@shara94)

    @champsupertramp
    Do u know why does not work condition logical in popups?
    For example as u know, I have register form with Conditional logic.

    if is selected something show other field.

    this function does not work when I insert register shortcode in popups. I have tried many plugin but its same to all.

    any Idea?

    Thanks

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @shara94

    The register form has to be visible on page load for the conditional logic to work. When the register form is hidden, the javascript cannot find the hidden form to process the conditional logic fields.

    Regards,

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Have a question’ is closed to new replies.