Title: shimmyshack's Replies | WordPress.org

---

# shimmyshack

  [  ](https://wordpress.org/support/users/shimmyshack/)

 *   [Profile](https://wordpress.org/support/users/shimmyshack/)
 *   [Topics Started](https://wordpress.org/support/users/shimmyshack/topics/)
 *   [Replies Created](https://wordpress.org/support/users/shimmyshack/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/shimmyshack/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/shimmyshack/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/shimmyshack/engagements/)
 *   [Favorites](https://wordpress.org/support/users/shimmyshack/favorites/)

 Search replies:

## Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Gmail SMTP] Grant Permission button does not appear after saving settings](https://wordpress.org/support/topic/grant-permission-button-does-not-appear-after-saving-settings/)
 *  [shimmyshack](https://wordpress.org/support/users/shimmyshack/)
 * (@shimmyshack)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/grant-permission-button-does-not-appear-after-saving-settings/#post-9001680)
 * The check in main.php
 *     ```
       if(isset($options['oauth_access_token']) && 
          !empty($options['oauth_access_token'])) {...
       ```
   
 * might succeed (and therefore return false) even if something is wrong.
 * Why not rename the “revoke permission” tab to “API Access”
    and move the [grant
   permission] to the new API access tab.
 * Then you could have the two buttons permanently on display under a status
 * API Access: [grant/green] / [revoke/red]
 * with your same
 * Status: (Connected / Disconnected) UI
 * Also just having a URL to cause the grant action, despite it NOT being possible,
   causes a 500 error. Whereas checking for can_grant_permissions could be done 
   on the
 * /wp-admin/options-general.php?page=gmail-smtp-settings&action=oauth_grant
 * URL, and not proceed if check fails.
 * As an aside. Currently can_grant_permission returns true by default. How about
   returning false by default. You code is then simplified.
 * from
 *  function can_grant_permission(){
    $options = gmail_smtp_get_option(); $grant_permission
   = true; if(!isset($options[‘oauth_client_id’]) || empty($options[‘oauth_client_id’])){
   $grant_permission = false; } if(!isset($options[‘oauth_client_secret’]) || empty(
   $options[‘oa`uth_client_secret’])){ $grant_permission = false; } if(isset($options[‘
   oauth_access_token’]) && !empty($options[‘oauth_access_token’])){ $grant_permission
   = false; } return $grant_permission; }`
 * to
 *     ```
           function can_grant_permission(){
               $options = gmail_smtp_get_option();    
               $grant_permission = false;
               if( !empty($options['oauth_client_id']) && //have id and
                   !empty($options['oauth_client_secret'] && //secret and
                   empty($options['oauth_access_token']) ){ //token is missing
                   $grant_permission = true;
               }
               return $grant_permission;
           }
       ```
   
 * as any other combo you either cant or dont want to grant permission
    -  This reply was modified 9 years, 1 month ago by [shimmyshack](https://wordpress.org/support/users/shimmyshack/).
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Show link when user is logged in](https://wordpress.org/support/topic/show-link-when-user-is-logged-in/)
 *  [shimmyshack](https://wordpress.org/support/users/shimmyshack/)
 * (@shimmyshack)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/show-link-when-user-is-logged-in/#post-576913)
 * no the reason people bad mouth open source applications is that they are ungrateful
   and demanding of peoples generousity and spare time.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [activation of a plugin class](https://wordpress.org/support/topic/activation-of-a-plugin-class/)
 *  Thread Starter [shimmyshack](https://wordpress.org/support/users/shimmyshack/)
 * (@shimmyshack)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/activation-of-a-plugin-class/#post-587583)
 * my bad – kinda – I used
 * register_activation_hook(
    str_replace(‘\\’,’/’,__FILE__), array(&$this, ‘make_table’));
 *  str_replace(‘\\’,’/’,
    was needed on my windows test box, and array(&$this, 
   was needed to reference themethod that would be run.
 * Ta.

Viewing 3 replies - 1 through 3 (of 3 total)