Quick tip for the Affiliates plugin

For those who want to provide a quick link to affiliates pages for members etc.

hmm ok have to post this to add code.

  • Tom Eagles
    • Syntax Hero

    just replace the part of the line that says !is_super_admin() to !is_whatever user type(s) you want. and obviously the yourdomain part and a url to the page you create for them etc. in my case i just created a page using shortcodes and saved it with a url of your-affiliate-reports under permalinks. the same for the registration page its up to you how you do it. In fact the same exact method can be used for all pages etc.

    add_action('admin_bar_menu', 'my_admin_bar_link');
    // new custoom menu
    function my_admin_bar_menu() {
    	global $wp_admin_bar;
    	if ( !is_super_admin() || !is_admin_bar_showing() )
    	$wp_admin_bar->add_menu( array(
    	'id' => 'affiliate_program',
    	'title' => __( 'Affiliate Program'),
    	'href' => FALSE ) );
    	$wp_admin_bar->add_menu( array(
    	'parent' => 'affiliate_program',
    	'title' => __( 'Register'),
    	'href' => 'http://yourdomain/affiliate-program' ) );
    	$wp_admin_bar->add_menu( array(
    	'parent' => 'affiliate_program',
    	'title' => __( 'My Affiliate Reports'),
    	'href' => 'http://yourdomain/affiliate-program/your-affiliate-reports' ) );
    add_action('admin_bar_menu', 'my_admin_bar_menu');

    add this to your functions.php, i added mine just before the last ?>

    now you will have a new menu item on the admin bar with a link for them to register as an affiliate and for them to check their reports.

    Only downer is if you update the theme you will have to paste it back into the functions.php

  • aecnu
    • WP Unicorn

    Greetings Tom,

    Thank you for your input and we look forward to your next installment hopefully with the error worked out.

    Your coding work is certainly appreciated and once you have an error less code going I am sure members will be ecstatic.

    Look forward to hearing from you in any event.

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.