Remove the front end user login/register tool bar using backend options.
Hi,
This was bugging me because I couldn't remove this bloody bar without deleting code or adding css changes. Which is what I didn't want to do.
So I figured out a way to remove the front end user login/register bar without css fixes and without deleting any code.
This method will allow the admin to remove this bar just by selecting yes or no as an option in the back end.
I am using classipress 3.19 and
WP 3.4.1.
What I did.
Created some new admin values which go into the admin-values.php file.
Adapted a few lines within the theme-header.php file.
1 - add the admin values.
array( 'name' => __('Disable User Toolbar Frontend','appthemes'),
'desc' => '',
'tip' => __("This will remove the user toolbar at the top of your web site which is displayed for all non logged in users.",'appthemes'),
'id' => $app_abbr.'_remove_frontenduser_toolbar',
'css' => 'width:100px;',
'std' => '',
'vis' => '',
'req' => '',
'
js' => '',
'min' => '',
'type' => 'select',
'options' => array( 'no' => __('No', 'appthemes'),
'yes' => __('Yes', 'appthemes'))),
This will show up as a new option in the back end under classipress/settings/advance called: Disable User Toolbar Frontend - with two options. Yes or No.
2- Replace this code in theme-header.php
<div class="header_top_res">
<p>
<?php echo cp_login_head(); ?>
<a href="<?php if (get_option('cp_feedburner_url')) echo get_option('cp_feedburner_url'); else echo get_bloginfo_rss('rss2_url').'?post_type='.APP_POS T_TYPE; ?>" target="_blank"><img src="<?php bloginfo('template_url'); ?>/images/icon_rss.gif" width="16" height="16" alt="rss" class="srvicon" /></a>
<?php if ( get_option('cp_twitter_username') ) : ?>
|
<a href="http://twitter.com/<?php echo get_option('cp_twitter_username'); ?>" target="_blank"><img src="<?php bloginfo('template_url'); ?>/images/icon_twitter.gif" width="16" height="16" alt="tw" class="srvicon" /></a>
<?php endif; ?>
</p>
</div><!-- /header_top_res -->
with this
<?php if (get_option('cp_remove_frontenduser_toolbar') =='no') { ?>
<div class="header_top_res">
<p>
<?php echo cp_login_head(); ?>
<a href="<?php if (get_option('cp_feedburner_url')) echo get_option('cp_feedburner_url'); else echo get_bloginfo_rss('rss2_url').'?post_type='.APP_POS T_TYPE; ?>" target="_blank"><img src="<?php bloginfo('template_url'); ?>/images/icon_rss.gif" width="16" height="16" alt="rss" class="srvicon" /></a>
<?php if ( get_option('cp_twitter_username') ) { ?><?php } ?>
|
<a href="http://twitter.com/<?php echo get_option('cp_twitter_username'); ?>" target="_blank"><img src="<?php bloginfo('template_url'); ?>/images/icon_twitter.gif" width="16" height="16" alt="tw" class="srvicon" /></a>
</p>
</div><!-- /header_top_res -->
<?php } ?>
And thats it.
Now when you want to remove the front end user tool bar just go to classipress/settings/advance and select Yes as an option in the new option you have created. Save the new settings and check it out on your site. The toolbar should have disappeared.
If you want it to show. Just select No as an option.
Hope this helps others with the same issue.
Regards
Jason.