WordPress.org

Ready to get started?Download WordPress

Forums

WP SMS Validation
[resolved] How to add verification button/link in Site Admin (Back end)? (7 posts)

  1. Cyborg Feelings
    Member
    Posted 1 year ago #

    Hi,

    I have more than 1000 registered subscribers for my WordPress blog.

    The problem is when a new user sign up for my blog then he/she need to verify by SMS Validation which is ok. But what about users that are already registered before I installed this plugin?

    Is it anyway to ADD a field in Back End where already registered and NOT verified users gets the option to enter there phone number and click Verify to get a SMS with CODE so they can verify after logging in?
    ---

    This plugin is little scary cause it LOADS on ALL pages, ALL posts, Front page and Back end. This plugin is NOT good for SEO cause it increases all my internal links by 150KB!!! Which is NOT useful for visitor/guest.

    This Plugin should ONLY load if page is: login.php or in wp-admin area and NOT in front page!!! It will help to load other pages faster and will reduce unesscary scripts to load.
    ---

    I saw also a other BUG in this plugin so after a user Verifies there phone number and logs in then they can simply update or delete the VERIFIED phone number.
    To avoid that I have changed sms-validator.php to (READONLY):
    ---- `
    <td>
    <input type="text" name="csnetworkssms-mobile" <?php echo current_user_can( 'edit_users' ) ? '' : 'readonly'; ?> id="csnetworkssms-mobile" maxlength="20" size="20" value="<?php echo $csnetworkssms_mobile; ?>" />
    </td>
    `----

    Now I need your help about how to call the Verification / Re-Verify from Back End?
    And whats the name of this function which load this plugin on all pages? So I can unhook/unregister or remove it from single_post, page and frontend.

    Thank you for all your help and good work with this plugin :-)

    http://wordpress.org/plugins/sms-validator/

  2. befree22
    Member
    Posted 11 months ago #

    Hi,

    Were you able to fix this sms plugin's load problem so that it only loads on the login page and admin page?

  3. Cyborg Feelings
    Member
    Posted 11 months ago #

    Hi,

    Yes, but to do that I had to install: Plugin Organizer.
    Then goto Global Plugins and set SMS Validator to OFF

    And then add 2 Plugin Filters:
    1 to set SMS Validator ON for http://mysite.com/wp-login.php?action=register
    2 to set SMS Validator ON for http://mysite.com/wp-login.php

    In backend (admin page) it's always ON which is ok.
    I have also modified it to use with smsglobal.com gateway.

  4. befree22
    Member
    Posted 11 months ago #

    I really appreciate your quick response.

    OK, so you fixed the loading bug so that the plugin only load on the login page and admin backend.

    So you switched from http://www.cs-networks.net to smsglobal.com service? Is the latter cheaper? What code changes would I need to make smsglobal.com work?

  5. Cyborg Feelings
    Member
    Posted 11 months ago #

    Yes, I successfully disabled it on front-end and now it only loads on the login/register pager and admin backend.

    smsglobal.com is not cheaper but I like there backend with Logs over sent SMS's, Deliver Reports, Delivery report on mail and more.

    To get GlobalSMS to work you will need to modify gateways.php

    // auth call
            $baseurl = "http://www.smsglobal.com";
    
            $url = sprintf( '%s/http-api.php?action=sendsms&user=%s&password=%s&&from=CYBORG&to=%s&text=%s', $baseurl, $username, $password, $sms_data['to'], $msg );
    
                // do sendmsg call

    And Replace: CYBORG to the name or number you wish to send SMS from.

    If you use this plugin then you will be interested in this:
    http://stackoverflow.com/questions/18450914/php-how-to-give-error-if-the-entered-field-value-starts-with-0-00-or

    Update this functions in: sms-validator.php

    /**
         * Validates phone number
         *
         * @param type $errors
         * @return type
         */
    
        function registration_errors( $errors ) {
            $enabled = csnetworks_sms_get_option( 'register_form' );
    
            if ( $enabled == 'on' ) {
                $phone = $_POST['user_phone'];
    
    if($phone[1] == '0')
    $phone = substr($phone, 2);
    
    if($phone[0] == '0')
    {
    $errors->add( 'invalid_inter_phone', __( '<strong>ERROR</strong>: Phone Number you entered is NOT a international number.', 'csnetworks' ) );
    }
                if ( $phone == '' ) {
                    $errors->add( 'empty_phone', __( '<strong>ERROR</strong>: Please type your phone number.', 'csnetworks' ) );
                } else if ( phone_exists( $phone ) ) {
                    $errors->add( 'phone_exists', __( '<strong>ERROR</strong>: Phone number is already registered.', 'csnetworks' ) );
                } else {
                    if ( preg_match( '/[^\d]/', $phone ) || (strlen( $phone ) < 10 ) ) {
                        $errors->add( 'invalid_phone', __( '<strong>ERROR</strong>: Please type a valid Phone Number<br />(10 digit minimum and do NOT use "+")', 'csnetworks' ) );
                    }
    
                }
            }
    
            return $errors;
        }
  6. ihtsham
    Member
    Posted 3 months ago #

    Dear Amir (cyborg)

    is the above code complete in all sorts, should i copy paste it as advised above, i need to use bulksms tool.
    i know nothing about php but know HTML well.

    reply soon.

    thanks.

  7. ihtsham
    Member
    Posted 3 months ago #

    i may be reached at ihtxam@gmail.com
    you private reply would also be much appreciated . thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic