Exemple #1
0
/**
 * This is the PNM shortcode entry point
 **/
function ifcrush_pnm()
{
    // 	global $debug;
    // 	if ($debug) echo "[ifcrush_pnm] ";
    if (!is_user_logged_in()) {
        echo "sorry you must logged in as a pnm to access this page.";
        return;
    }
    $current_user = wp_get_current_user();
    if (is_user_a_pnm($current_user)) {
        /* get the frat of the rc */
        $pnm_netID = get_pnm_netID($current_user);
    } else {
        echo "sorry you must logged in as a pnm to access this page.";
        return;
    }
    /* 
     * Now I know who I am.
     */
    $username = get_current_user_name($current_user);
    echo "Hello {$username}.  You attended these events:<br><br>";
    ifcrush_eventreg_for_pnm($pnm_netID);
    /** all done **/
}
Exemple #2
0
/**
 * Redirect user after successful login. - this needs to be after the include
 * for ifcrush_user_support.php because it uses the user functions
 *
 * @param string $redirect_to URL to redirect to.
 * @param string $request URL the user is coming from.
 * @param object $user Logged users data.
 * @return string
 */
function my_login_redirect($redirect_to, $request, $user)
{
    //is there a user to check?
    global $user;
    if (isset($user->roles) && is_array($user->roles)) {
        //check for admins
        if (in_array('administrator', $user->roles)) {
            // redirect them to the default place
            return $redirect_to;
        } else {
            if (is_user_a_pnm($user)) {
                return home_url("/?page_id=66");
                // HACK HACK HACK fix the number
            } else {
                if (is_user_an_rc($user)) {
                    return home_url("/?page_id=64");
                    // HACK HACK HACK fix the number
                }
            }
        }
    } else {
        return $redirect_to;
    }
}