• Resolved fishnyc22

    (@fishnyc22)


    Hey there. Question about this plugin. I want to have a sidebar on a category archive page that shows the contributors (author) and their bio. I would like to loop though the users, get all authors who have a category checked off and list them. Can you help me figure out how to get that data looping through the users. Any help is greatly appreciated. Thanks for creating this plugin.

    Regards,

    Dave

    https://wordpress.org/plugins/author-category/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Bainternet

    (@bainternet)

    I don’t see whats that got to do with this plugin.

    contact me using my sites contact form I’ll see if I can help you.

    Thread Starter fishnyc22

    (@fishnyc22)

    Hey there… I was hoping the creator of the plugin would be able to tell me what values I need to look for for when looping through users. I need to know what categories the user is restricted to posting to based on what was selected in their user profile using your plugin.

    Sorry if I wasn’t clear. Thanks.

    Plugin Author Bainternet

    (@bainternet)

    Well that is more clear 🙂

    you can create copy the plugin method named get_user_cat
    which accepts a user ID and returns the category term ID (if one was selected for that user) or zero (if not).

    function get_user_cat($user_id = null){
    	if ($user_id === null){
    		global $current_user;
    		get_currentuserinfo();
    		$user_id = $current_user->ID;
    	}
    	$cat = get_user_meta($user_id,'_author_cat',true);
    	if (empty($cat) || count($cat) <= 0 || !is_array($cat))
    		return 0;
    	else
    		return $cat[0];
    
    }

    as for looping over users take a look at the examples listed at:
    http://codex.wordpress.org/Function_Reference/get_users#Examples

    Thread Starter fishnyc22

    (@fishnyc22)

    Forgot to thank you for this tip. that function is just what I needed. Cheers.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Looping through users’ is closed to new replies.