• Resolved mattnyy

    (@mattnyy)


    I’m looking to make a button, that a plugin inserted in my profile page, viewable to the admin only. I don’t need basic users to see the button that this plugin inserted. Any idea on how I can do that? I’ve been reading about a CURRENT_USER_CAN code but no idea how or where to implement.

    Thank you if anyone can help.

    <table class="form-table" ><tr>
    
          <th><h3><?php _e('Billing / Invoicing Info', ud_get_wp_invoice()->domain) ?></h3></th>
    
          <td>
    
    		<input type="button" onclick="window.location.href='<?php echo $wpi_settings['links']['manage_invoice'].$email; ?>'" class="button" value="<?php echo  __('Send New Invoice', ud_get_wp_invoice()->domain) ?>" id="crm_new_invioce"/>
    
          </td>
    
        </tr>
    
    </table>
Viewing 2 replies - 1 through 2 (of 2 total)
  • anonymized-15380454

    (@anonymized-15380454)

    1. Add this before the <table> tag:

    <?php if ( current_user_can('administrator') ) : ?>

    2. Add this after the </table> tag:

    <?php endif; ?>

    Hope that helps.

    Thread Starter mattnyy

    (@mattnyy)

    Awesome, thank you Sally! Worked perfectly ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Admin viewable only button?’ is closed to new replies.