-
Author
-
July 6, 2015 at 11:14 #66792
netweavers
ParticipantHi,
I have a problem with my site based on KLEO theme.
The problem is very weird.
When I am logged in to the site as an admin everything works good!But when I am logged in as a subscriber:
– I CAN’T UPLOAD AVATAR,
– I CAN’T POST anything on activity page.I would like to emphasize that everything works good when I am logged in as an admin.
Those problems occurs when I’m logged as a subscriber.Any advice appreciated.
July 6, 2015 at 11:21 #66795netweavers
ParticipantPlease test:
members.pureskyclub.com – site
members.pureskyclub.com/wp-admin/ – admin panelTest user:
login: test
password: testJuly 6, 2015 at 14:37 #66831sharmstr
ModeratorI need admin credentials as well
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 6, 2015 at 17:05 #66905netweavers
ParticipantPlease test:
members.pureskyclub.com – site
members.pureskyclub.com/wp-admin/ – admin panelI created temporary admin account for You:
login: sharmstr
password: supportT4rNaAny advice appreciated.
July 6, 2015 at 17:28 #66910sharmstr
ModeratorStrange. Try clearing your cache and disabling plugins. Probably a conflict.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 6, 2015 at 17:30 #66911sharmstr
ModeratorHow old is the buddypress-functions.php file in your child theme? If its from before you upgraded Kleo, that could be your issue.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 6, 2015 at 17:54 #66919netweavers
ParticipantI found that this is caused by my child theme functions.php file.
I need to find what is the cause of it.July 6, 2015 at 17:57 #66920netweavers
Participant<?php
// CUSTOM LOCKDOWN REDIRECT
add_action( ‘wp’, ‘custom_lockdown_redirect’, 3 );
function custom_lockdown_redirect(){
global $wp;
if (!is_user_logged_in()){
if ( bp_is_activation_page()
|| bp_is_register_page()
|| is_page_template( ‘template-custom-lockdown.php’ )
|| is_page_template( ‘template-reset.php’ )
|| ( in_array( $GLOBALS[‘pagenow’], array( ‘wp-login.php’ )))
)
return;
bp_core_redirect(get_option(‘siteurl’) . “/welcome”);
exit;
}
}// CUSTOM LOGIN ERRORS
/**
* Function Name: front_end_login_fail.
* Description: This redirects the failed login to the custom login page instead of default login page with a modified url
**/
add_action( ‘wp_login_failed’, ‘front_end_login_fail’ );
function front_end_login_fail( $username ) {// Getting URL of the login page
$referrer = $_SERVER[‘HTTP_REFERER’];
// if there’s a valid referrer, and it’s not the default log-in screen
if( !empty( $referrer ) && !strstr( $referrer,’wp-login’ ) && !strstr( $referrer,’wp-admin’ ) ) {
wp_redirect( $referrer . “?login=failed” );
exit;
}
}/**
* Function Name: check_username_password.
* Description: This redirects to the custom login page if user name or password is empty with a modified url
**/
add_action( ‘authenticate’, ‘check_username_password’, 1, 3);
function check_username_password( $login, $username, $password ) {// Getting URL of the login page
$referrer = $_SERVER[‘HTTP_REFERER’];// if there’s a valid referrer, and it’s not the default log-in screen
if( !empty( $referrer ) && !strstr( $referrer,’wp-login’ ) && !strstr( $referrer,’wp-admin’ ) ) {
if( $username == “” || $password == “” ){
wp_redirect( $referrer . “?login=empty” );
exit;
}
}}
// Replace my constant ‘LOGIN_PAGE_ID’ with your custom login page id.// FOOTER ADMIN
function change_footer_admin () {
echo ‘Projekt i wykonanie: Netweavers – Agencja Interaktywna‘;
}add_filter(‘admin_footer_text’, ‘change_footer_admin’);
function my_login_logo() { ?>
<style type=”text/css”>
body.login div#login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/img/logo_full.png);
padding-bottom: 0px;
-webkit-background-size: auto;
background-size: auto;
background-position: center top;
background-repeat: no-repeat;
color: #999;
height: 150px;
font-size: 20px;
font-weight: 400;
line-height: 1.3em;
margin: 0 auto 25px;
padding: 0;
text-decoration: none;
width: auto;
text-indent: -9999px;
outline: 0;
overflow: hidden;
display: block;
}
</style>
<?php }
add_action( ‘login_enqueue_scripts’, ‘my_login_logo’ );add_action(‘bp_ajax_querystring’,’bpdev_exclude_users’,20,2);
function bpdev_exclude_users($qs=false,$object=false){
//list of users to exclude$excluded_user=join(‘,’, bpdev_get_subscriber_admin_user_ids());//comma separated ids of users whom you want to exclude
if($object!=’members’)//hide for members only
return $qs;$args=wp_parse_args($qs);
//check if we are searching for friends list etc?, do not exclude in this case
if(!empty($args[‘user_id’]))
return $qs;if(!empty($args[‘exclude’]))
$args[‘exclude’]=$args[‘exclude’].’,’.$excluded_user;
else
$args[‘exclude’]=$excluded_user;$qs=build_query($args);
return $qs;
}
function bpdev_get_subscriber_admin_user_ids(){
$users=array();
$subscribers= get_users( array( ‘role’ => ‘rpr_unverified’ ,’fields’=>’ID’) );
$admins= get_users( array( ‘role’ => ‘administrator’ ,’fields’=>’ID’) );$users = array_merge($subscribers,$admins);
return $users;
}function bp_remove_gravatar ($image, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir) {
$default = get_stylesheet_directory_uri() .’/assets/img/default_user.jpg’;
if( $image && strpos( $image, “gravatar.com” ) ){
return ‘
‘;
} else {
return $image;}
}
add_filter(‘bp_core_fetch_avatar’, ‘bp_remove_gravatar’, 1, 9 );function remove_gravatar ($avatar, $id_or_email, $size, $default, $alt) {
$default = get_stylesheet_directory_uri() .’/assets/img/default_user.jpg’;
return ““;
}add_filter(‘get_avatar’, ‘remove_gravatar’, 1, 5);
function bp_remove_signup_gravatar ($image) {
$default = get_stylesheet_directory_uri() .’/assets/img/default_user.jpg’;
if( $image && strpos( $image, “gravatar.com” ) ){
return ‘
‘;
} else {
return $image;
}}
add_filter(‘bp_get_signup_avatar’, ‘bp_remove_signup_gravatar’, 1, 1 );function my_footer_shh() {
remove_filter( ‘update_footer’, ‘core_update_footer’ );
}add_action( ‘admin_menu’, ‘my_footer_shh’ );
/**
* Proper way to enqueue scripts and styles
*/
function theme_name_scripts() {
wp_enqueue_style( ‘font-awesome’, ‘//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css’ );
}add_action( ‘wp_enqueue_scripts’, ‘theme_name_scripts’ );
/**
* FLUSH PERMALINKS
*/function edit_tabs_options() {
global $bp;//MODIFY MAIN PROFILE TABS
$bp->bp_nav[‘activity’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/#object-nav’; //IT’S WORK
$bp->bp_nav[‘profile’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/profile/#object-nav’; //IT’S WORK
$bp->bp_nav[‘notifications’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/notifications/#object-nav’; //IT’S WORK
// $bp->bp_nav[‘messages’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/messages/#object-nav’; //IT’S WORK
$bp->bp_nav[‘friends’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/friends/#object-nav’; //IT’S WORK
$bp->bp_nav[‘groups’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/groups/#object-nav’; //IT’S WORK
$bp->bp_nav[‘forums’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/forums/#object-nav’; //IT’S WORK
// $bp->bp_nav[‘settings’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/settings/#object-nav’; //IT’S WORK
//MODIFY ACTIVITY SUB PROFILE NAV
$bp->bp_options_nav[‘activity’][‘mentions’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/activity/mentions/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘activity’][‘favorites’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/activity/favorites/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘activity’][‘friends’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/activity/friends/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘activity’][‘groups’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/activity/groups/#object-nav’; //IT’S WORK
//MODIFY PROFILE SUB PROFILE NAV
$bp->bp_options_nav[‘profile’][‘edit’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/profile/edit/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘profile’][‘change-avatar’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/profile/change-avatar/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘profile’][‘change-cover’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/profile/change-cover/#object-nav’; //IT’S WORK
//MODIFY NOTIFICATIONS SUB PROFILE NAV
$bp->bp_options_nav[‘notifications’][‘unread’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/notifications/unread/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘notifications’][‘read’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/notifications/read/#object-nav’; //IT’S WORK
//MODIFY MESSAGES SUB PROFILE NAV
$bp->bp_options_nav[‘messages’][‘inbox’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/messages/inbox/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘messages’][‘sentbox’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/messages/sentbox/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘messages’][‘compose’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/messages/compose/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘messages’][‘notices’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/messages/notices/#object-nav’; //IT’S WORK
//MODIFY FRIENDS SUB PROFILE NAV
$bp->bp_options_nav[‘friends’][‘requests’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/friends/requests/#object-nav’; //IT’S WORK
//MODIFY GROUPS SUB PROFILE NAV
$bp->bp_options_nav[‘groups’][‘invites’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/groups/invites/#object-nav’; //IT’S WORK
//MODIFY FORUMS SUB PROFILE NAV
$bp->bp_options_nav[‘forums’][‘topics’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/forums/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘forums’][‘replies’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/forums/replies/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘forums’][‘favorites’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/forums/favorites/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘forums’][‘subscriptions’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/forums/subscriptions/#object-nav’; //IT’S WORK
//MODIFY SETTINGS SUB PROFILE NAV
$bp->bp_options_nav[‘settings’][‘general’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/settings/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘settings’][‘notifications’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/settings/notifications/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘settings’][‘profile’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/settings/profile/#object-nav’; //IT’S WORK
$bp->bp_options_nav[‘settings’][‘blocked’][‘link’] = ‘/members/’. bp_get_displayed_user_username() .’/settings/blocked/#object-nav’; //IT’S WORK
}
add_action( ‘bp_setup_nav’, ‘edit_tabs_options’ );/**
* Disable admin bar on the frontend of your website
* for subscribers.
*/
function themeblvd_disable_admin_bar() {
if( ! current_user_can(‘edit_posts’) )
add_filter(‘show_admin_bar’, ‘__return_false’);
}
add_action( ‘after_setup_theme’, ‘themeblvd_disable_admin_bar’ );/**
* Redirect back to homepage and not allow access to
* WP admin for Subscribers.
*/
function themeblvd_redirect_admin(){
if ( ! current_user_can( ‘edit_posts’ ) ){
wp_redirect( site_url() );
exit;
}
}
add_action( ‘admin_init’, ‘themeblvd_redirect_admin’ );function filter_reset_password_request_email_body( $message, $key, $user_id ) {
$user_login = bp_core_get_username( $user_id );
$message = sprintf( __( ‘Login: [your email adress]’ ) ) . “\r\n\r\n”;
$message .= __( ‘To get a new password, visit the following link:’ ) . “\r\n\r\n”;
$message .= network_site_url( “wp-login.php?action=rp&key=$key&login=” . rawurlencode( $user_id ), ‘login’ ) . “\r\n\r\n”;return $message;
}
add_filter( ‘retrieve_password_message’, ‘filter_reset_password_request_email_body’, 10, 3 );July 6, 2015 at 18:34 #66923sharmstr
ModeratorStart with a blank one and add each function one at a time until you find the issue.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionJuly 6, 2015 at 19:19 #66935netweavers
ParticipantThank You for your help. I removed 2 functions and everything is working well now.
July 6, 2015 at 19:28 #66940sharmstr
ModeratorThere’s still the possible issue of that buddypress-functions.php file being old. Not sure when you added it, but you if it was before Kleo 3.0, then you are missing functions and changes.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘KLEO’ is closed to new topics and replies.