Osclass Support Forums

Osclass plugin support => SMS Notification and Verification Plugin => Topic started by: Wiz on March 11, 2023, 05:47:42 AM

Title: [Suggestion] Allow chat access after verification
Post by: Wiz on March 11, 2023, 05:47:42 AM
Hello,

Please consider adding chat access to the plugin's verification restriction list which is currently:

- Publish page
- User pages
- Instant Messenges
- OSP

Thank you!

Wiz
Title: Re: [Suggestion] Allow chat access after verification
Post by: MB Themes on March 11, 2023, 12:46:39 PM
Why not to allow to logged-in users and require phone verification for registered?
Sounds easier
Title: Re: [Suggestion] Allow chat access after verification
Post by: Wiz on March 11, 2023, 07:38:31 PM
Unless I missed something, the chat plugin can be accessed and used from the homepage which is not restricted by the SMS plugin's phone verification restriction list.

Try it, you can access the homepage and browse anywhere without verification even if it was enabled and user is logged in except for user/publish/instant messages/osp sections.


I'm all for simple solutions  ;)
Title: Re: [Suggestion] Allow chat access after verification
Post by: Wiz on March 11, 2023, 07:50:40 PM
This is what I see after logging in with phone verification and chat enabled but phone not verified.

Edit: added another screenshot of homepage with logged in user and without phone being verified.
Title: Re: [Suggestion] Allow chat access after verification
Post by: MB Themes on March 14, 2023, 09:14:57 PM
You would need to condition button that's shown in front.
You could use:
Code: [Select]
<?php
if(sms_phone_verify($logged_user_phone)) {
... 
show chat button ...
}
?>
Title: Re: [Suggestion] Allow chat access after verification
Post by: MB Themes on March 14, 2023, 09:19:14 PM
Created one function (will be added later to plugin):
Code: [Select]
// CHECK IF USER IS VERIFIED
function sms_check_user_verified($user_id = NULL) {
  if($user_id === NULL) {
    $user_id = osc_logged_user_id();
  }

  if($user_id > 0) {
    $user = User::newInstance()->findByPrimaryKey($user_id);

    if(isset($user['s_phone_mobile']) && trim((string)$user['s_phone_mobile']) != '' && sms_phone_verify($user['s_phone_mobile'])) {
      return true;
    }
  }
 
  return false;
}

You can use it to check if user is verified as well ;)
Title: Re: [Suggestion] Allow chat access after verification
Post by: Wiz on March 15, 2023, 08:00:07 PM
Nice!! Thank you  8)
Title: Re: [Suggestion] Allow chat access after verification
Post by: Wiz on April 02, 2023, 08:36:20 AM
Hi,

If I wanted to enforce sms verification for all logged in sessions, not only chat, how would I hook the function you created above? I just realized unverified accounts are able to view masked phone numbers as well.

So basically, registered and unverified users can't view masked numbers, use chat or any site service that requires signing in to interact with other users.

Thanks
Title: Re: [Suggestion] Allow chat access after verification
Post by: MB Themes on April 03, 2023, 10:23:31 AM
@Wiz
By default when verification is enabled, then users need to verify their account if they access user area.
You would only need to change this to trigger verification on listing page as well.
Title: Re: [Suggestion] Allow chat access after verification
Post by: Wiz on April 03, 2023, 06:39:01 PM
Alright, thank you!