Jump to content

Check if member is validated


Fidde

Recommended Posts

Posted

I have a script that checks if the user is the the group guest (not logged in at all) or members and allow access only to members to the page. However you can access the page as soon as you have registered, you don't even have to confirm your email (we even have manual validation on), so I was wondering if there is a way to check if the account is verified and then deny access.

<?php

// Initialize IPS4 Framework

require_once( '../init.php' );
require_once( '../conf_global.php' );
require_once( 'pnum.php' );

// Indicate that we should consider this a front-end session so we can obtain the currently logged in users information.

\IPS\Session\Front::i();
// Grab the currently Logged In user.

$member = \IPS\Member::loggedIn();
if ($member->mgroup_others) {
    $cn_membergroups = explode(',', $member->mgroup_others);
}

$cn_membergroups[] = $member->member_group_id;
?>
if (!in_array(3, $cn_membergroups)) {
    //Don't allow access
} else {
//display the page

 

Posted
12 hours ago, Daniel F said:

Do you mean if the member verified his email address or if the admin approved the member?


IPS\Member::loggedIn()->members_bitoptions['validating']

Works perfect, thanks :)

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...