# charitable/1.3.4/includes/users/charitable-user-functions.php

Charitable – Donation &amp; Fundraising Platform (Donation Forms, Recurring Donations &amp; Fundraising Campaigns), version 1.3.4. 36 lines.

- Page: https://pluginprobe.com/plugins/charitable/1.3.4/code/includes/users/charitable-user-functions.php
- Raw: https://pluginprobe.com/plugins/charitable/1.3.4/raw/includes/users/charitable-user-functions.php
- Modified: 2015-08-29T11:02:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/charitable/1.3.4/code/includes/users/charitable-user-functions.php#L10-L20`.

```php
<?php 

/**
 * Charitable User Functions. 
 *
 * User related functions.
 * 
 * @package     Charitable/Functions/User
 * @version     1.0.0
 * @author      Eric Daams
 * @copyright   Copyright (c) 2015, Studio 164a
 * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License  
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

/**
 * Returns a Charitable_User object for the given user. 
 *
 * This will first attempt to retrieve it from the object cache to prevent duplicate objects.
 *
 * @param   int     $user_id
 * @param   boolean $foce
 * @return  Charitable_User
 * @since   1.0.0
 */
function charitable_get_user( $user_id, $force = false ) {
    $user = wp_cache_get( $user_id, 'charitable_user', $force );

    if ( ! $user ) {
        $user = new Charitable_User( $user_id );
        wp_cache_set( $user_id, $user, 'charitable_user' );            
    }

    return $user;
}
```
