Osclass Support Forums

Osclass plugin support => SMS Notification and Verification Plugin => Topic started by: Сергей Иванов on November 23, 2020, 10:59:59 AM

Title: Selecting pages for checking your phone via SMS
Post by: Сергей Иванов on November 23, 2020, 10:59:59 AM
Hi! How can I select pages where the plugin will require phone number confirmation via SMS? Now the phone confirmation page appears when you try to add a new ad, when you try to log in to the user profile, when you try to log in to your personal account. How can I make the phone number confirmation page appear via SMS immediately after the user registers and logs in to the account, or how can I prevent sending private messages until the user passes verification? I appreciate your help
Title: Re: Selecting pages for checking your phone via SMS
Post by: Сергей Иванов on November 24, 2020, 12:37:36 PM
when adding osc_is_ad_page (), at least it does not allow you to go to the ad page and write a personal message without passing moderation. And how do I redirect when a user opens a window (fancybox) for a personal message?
Title: Re: Selecting pages for checking your phone via SMS
Post by: MB Themes on November 24, 2020, 03:38:12 PM
@Сергей
Following method could be used to verify user on particular pages.
It will work just if setting in plugin "User Account Phone Verification" is enabled.
Works just for logged-in users.
Only what should be modified is this condition: osc_is_ad_page() || osc_is_home_page() || osc_is_search_page()

Code: [Select]
function sms_user_verify_extra() {
  $location = Rewrite::newInstance()->get_location();
  $section  = Rewrite::newInstance()->get_section();

  if(osc_is_web_user_logged_in() && (osc_is_ad_page() || osc_is_home_page() || osc_is_search_page()) && sms_param('verification_account') == 1) {
    $user = User::newInstance()->findByPrimaryKey(osc_logged_user_id());

    if(!sms_phone_verify($user['s_phone_mobile']) || $user['s_phone_mobile'] == '') {
      if($location <> 'sms' || $section <> 'user-verify') {
        osc_add_flash_info_message(__('In order to improve our services, you must verify your phone number', 'sms'));
        header('Location:' . osc_route_url('sms-user-verify', array('userId' => osc_logged_user_id())));
        exit;
      }
    }
  }
}

osc_add_hook('init', 'sms_user_verify_extra', 10);
Title: Re: Selecting pages for checking your phone via SMS
Post by: Сергей Иванов on November 25, 2020, 11:11:06 AM
I actually indicated this solution in the post above))) Is it possible to request confirmation of the phone number when the user tries to write a private message, that is, when fancybox opens
Title: Re: Selecting pages for checking your phone via SMS
Post by: MB Themes on November 25, 2020, 11:25:38 AM
@Сергей
Solution above with small modifications can do it.
Title: Re: Selecting pages for checking your phone via SMS
Post by: Сергей Иванов on November 25, 2020, 02:51:02 PM
The same thing... Only the user is asked to pass verification as soon as they log in to their account.... But this may alienate many from the site.... You need to let the user get acquainted with the site, and when you try, for example, to write a message to the user, immediately offer to check the number by SMS. So I don't think this issue could have been marked as resolved)))
Title: Re: Selecting pages for checking your phone via SMS
Post by: MB Themes on November 25, 2020, 03:34:34 PM
@Сергей
Personal needs and preference must be done by you, objective of forums is not write you code based on your request, but give you help. And you got perfect guide how to do it.
Good luck  ;)
Title: Re: Selecting pages for checking your phone via SMS
Post by: Сергей Иванов on November 27, 2020, 06:30:49 AM
No one asked you to write the code. I pointed out the correct solution, and you pretended that you had solved it)))
Title: Re: Selecting pages for checking your phone via SMS
Post by: atba on August 12, 2022, 07:47:37 PM
In index.php you can force any page to be checked