Adsense for Authors Settings

Set the adslot and the position of the ad here.

Current Admin Settings

'; echo 'Adslot given by Lemonoid Staff:'; echo $options['adslotid']; echo '
'; echo '
Adsense Ads will be displayed at the following spots in your post: '; echo $options['adposition'];*/ } add_action( 'admin_init', 'afa_settings' ); function afa_settings() { register_setting( 'afa_option_group', 'afa_option_name','afa_register_callback' ); //register_setting( 'afa_option_group2', 'afa_option_name2','afa_register_callback2' ); add_settings_section( 'afa_section1', '', 'afa_section_callback', 'afa_page' ); //add_settings_section( 'afa_section2', '', 'afa_section_callback2', 'afa_page2' ); //add_settings_field( 'adslotid', 'Ad Slot', 'afa_adslot', 'afa_page', 'afa_section1' ); add_settings_field( 'adposition', 'Position of the adspot', 'afa_position', 'afa_page', 'afa_section1' ); add_settings_field( 'adpubid', 'Adsense Pub ID', 'afa_adpub', 'afa_page', 'afa_section1' ); } function afa_position() { $options = get_option('afa_option_name'); //echo "
"; ?> "; echo "
"; }*/ function afa_adpub() { $options = get_option('afa_option_name'); //echo ""; echo "
"; } function afa_register_callback($input) { /*$newinput['adslot_id'] = trim($input['adslot_id']); if(!preg_match('/^[a-z0-9]{32}$/i', $newinput['adslot_id'])) { $newinput['adslot_id'] = ''; }*/ return $input; } function afa_register_callback2($input) { /*$newinput['adslot_id'] = trim($input['adslot_id']); if(!preg_match('/^[a-z0-9]{32}$/i', $newinput['adslot_id'])) { $newinput['adslot_id'] = ''; }*/ return $input; } function afa_section_callback( $arg ) { // echo section intro text here echo ''; } function afa_section_callback2( $arg ) { // echo section intro text here echo ''; } function add_adslot_text($user) { ?>

Add your Adslot ID given by the staff.
post_author; $flag = get_the_author_meta( 'afa_adslot_id', $authorId ); if($flag == "") { $flag == "test123"; } $ad_content = '
'; if($position == 'Top') { return $ad_content.'
'.$content; } else if($position == 'Bottom') { return $content.'
'.$ad_content; } else if($position == 'Disabled') { return $content; } } add_action('show_user_profile', 'add_adslot_text' ); add_action('edit_user_profile', 'add_adslot_text'); add_action( 'personal_options_update', 'save_adslot_text' ); add_action( 'edit_user_profile_update', 'save_adslot_text' ); register_activation_hook( __FILE__, 'afa_activate' ); function afa_activate() { add_user_meta( $user_id, $meta_key, $meta_value, $unique); add_user_meta( $user_id, $meta_key, $meta_value, $unique); update_option('afa_option_name[adposition]','Top'); //update_option('afa_option_name[adslotid]','123'); update_option('afa_option_name[adpub_id]','123'); } register_deactivation_hook(__FILE__, 'afa_deactivate' ); function afa_deactivate() { delete_option( 'afa_option_name' ); //delete_option( 'afa_option_name2' ); }?>