This topic contains 24 reply and 2 voices, and was last updated by Nayem 4 years, 1 month ago
Viewing 15 Posts - 1 through 15 (of 24 total)
Author Posts
August 14, 2015 at 7:27 pm 67048
Nayem I have bought the extention WPUF User Listing. However, the filters that I apply for Viewer Role (Show this field if the viewer (current logged in user or guest) has one of these role.) don't seem to work.
August 16, 2015 at 7:47 pm 67357
Nayem Nayem

Hello MareVise,

I am really sorry for being late. Can you please provide any screenshot?

August 17, 2015 at 1:26 pm 67565
MareVisie MareVisie

Hi Nayem,

Here’s the User Listing section in the admin menu:

And here’s what I see with the admin account (administrator role) in the frontend:

August 17, 2015 at 7:09 pm 67684
Nayem Nayem

Actually your screenshot does not describe the issue correctly. Can you please tell me the scenario?

August 18, 2015 at 12:11 pm 67751
MareVisie MareVisie

What I am trying to do is have information in the user listing profiles that is only visible by users with certain user roles. In order to do so the plugin offers Viewer role capabilities. Each meta field has checkboxes where you can hide fields from certain user roles. In the screenshots above I unchecked the two fields for the administrator role, meaning that the two fields can’t be seen on profile pages by users with an Administrator user role. However, when I log in as administrator and visit a profile page, the (supposed to be hidden) fields show up anyway.

August 18, 2015 at 12:34 pm 67754
Nayem Nayem

Please provide your login details by using this form: http://wedevs.com/provide-login-details/. I will have a look what is going wrong.

Thank you 🙂

August 18, 2015 at 12:44 pm 67755
MareVisie MareVisie

Done.

August 18, 2015 at 3:27 pm 67778
Nayem Nayem

Hello,

I got your details. Please allow us some time to check.

Thanks.

August 20, 2015 at 4:31 pm 68300
Nayem Nayem

Please check your site now.

Thanks.

August 25, 2015 at 6:09 pm 69010
MareVisie MareVisie

Hi Nayem,

It works now, but only for Primary roles. Is it possible to have it filter on ALL assigned user roles?

August 25, 2015 at 6:25 pm 69011
Nayem Nayem

Hello,

It is possible but you have to customize the plugin for that.

Thanks.

August 25, 2015 at 7:13 pm 69031
MareVisie MareVisie

Could you point me in the right direction? Where can I find the code that does this?

August 26, 2015 at 10:56 am 69082
Nayem Nayem

Hello,

Please open wpuf-profile-filed folder/userlisting-admin.php file. In this file you will get this function- function user_role_template(). You have to customize here.

Thanks.

August 26, 2015 at 2:16 pm 69115
MareVisie MareVisie

Isn’t the function can_user_see in wpuf-user-listing/userlisting.php controlling what users actually get to see?

August 26, 2015 at 2:54 pm 69119
MareVisie MareVisie

I changed the function to this:


   public static function can_user_see( $profile_role, $field, $user_role ) {

        // bail out if the current user role is not in the list
        if ( !in_array( $profile_role, $field['all_user_role'] ) ) {
            return false;
        }

        // check viewer role
		global $current_user;
		$current_user_roles = $current_user->roles;
		foreach($current_user_roles as $cur){
			
			if ( !in_array( $cur, $field['current_user_role'] ) ) {
				continue;
			} else {
				return true;
			};
			
		};
        return false;
    }

It’s now doing what I want it to do. Do you think it is safe to implement online? Will it mess with what you did in my admin panel?

August 26, 2015 at 3:05 pm 69121
Nayem Nayem

If you have customized anything in the core file of this add-on then you will loose those data when the plugin will be updated. So you should override the add-on file through child theme. It is safe to override.

Thanks.

Viewing 15 Posts - 1 through 15 (of 24 total)