Programmatically add button to block 7 - How do I programmatically create a button, place it in a block, 'weight it' and then make it visible to certain pages?

Code I've tried:

function openid_connect_block_info() {
  $blocks['openid_connect_login'] = array(
      'info' =&gt; t('Login Using PixelPin'),
      'cache' =&gt; DRUPAL_CACHE_PER_ROLE | DRUPAL_CACHE_PER_PAGE,
      'region' =&gt; 'content',
      'pages' =&gt; 'user/',
  );

  $blocks['openid_connect_register'] = array(
      'info' =&gt; t('Register Using PixelPin'),
      'cache' =&gt; DRUPAL_CACHE_PER_ROLE | DRUPAL_CACHE_PER_PAGE,
      'region' =&gt; 'content',
      'pages' =&gt; '/user/register',
  );
  return $blocks;
}


This code creates the button but doesn't put it under the content block and doesn't make it only visible on the specified pages.
Why not render in a tpl so you can control the look of it?

I see you already used hook_block_info() so you can complete this using hook_block_view() with a custom callback function to use hook_theme() 

Here is a complete example of it:

function openid_connect_block_info() {
  $blocks['openid_connect_login'] = array(
      'info' =&gt; t('Login Using PixelPin'),
      'cache' =&gt; DRUPAL_CACHE_PER_ROLE | DRUPAL_CACHE_PER_PAGE,
      'region' =&gt; 'content',
      'pages' =&gt; 'user/',
  );

  return $blocks;
}


then:

function openid_connect_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'openid_connect_login':
      $block['content'] = openid_connect_login();
      break;
  return $block;
}


then:

function openid_connect_login() {
  return theme('openid_connect_login_tpl', array('data' =&gt; NULL));
}


last thing here:

    function openid_connect_theme($existing, $type, $theme, $path) {
      return array(
        'openid_connect_login_tpl' =&gt; array(
          'variables' =&gt; array('data' =&gt; NULL),
          'template' =&gt; 'openid-connect-login',
          'path' =&gt; drupal_get_path('module', 'openid_connect') . '/theme',
        ),  
);
}


create your file inside you module under the name we gave openid-connect-login.tpl.php and put it in a folder I named theme .. 

I hope I understood it right and was helpful for you issue ..