• Resolved Artus

    (@tintalent)


    Im trying to display the county and flag in a list of users. I used the plugin Wp User Country by Adrian Lazariuc. It stores the information about country and displays the flag next to the name. Works fine in a custom authors page, but in the amrusers list only shows the id of the country. I tried to create a pluggable function with no luck, some help would be really appreciated. The field found in amrusers is wpusercountry_id.

    <?php
       function ausers_format_wpusercountry_id(){
    
        $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
    
        /*functions from the plugin (wp User Country) to display country name and flag*/
           <span class="country-name"><?php echo wpusercountry_img_display($curauth->ID);?><?php echo wpusercountry_name_display($curauth->ID);?></span>
    }
    ?>

    https://wordpress.org/plugins/amr-users/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author anmari

    (@anmari)

    I think you need to get someone with coding skills to help you.
    It will be more something like this:

    function ausers_format_wpusercountry_id($v, $u){
        $text = wpusercountry_img_display($u->ID).wpusercountry_name_display($u->ID);
    	return $text;
    }

    assuming those functions return data – by the sounds of their names, they echo data so it will not work then.
    However I am not familiar with that plugin and how their functions work, so cannot help more than that.

    Thread Starter Artus

    (@tintalent)

    Perfect! It worked just great! Thank you so much. It displays the name of the country and the flag. Im very happy.

    Only thing is that the search function does not find the country by name, just by id. Is there something I can do to make it work? I know Iam asking too much.

    Thank you again,

    Thread Starter Artus

    (@tintalent)

    I used a custom field instead, and attached a css class to display the pic, the plugin finds the country with no problems.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Help with pluggable function’ is closed to new replies.