-
Author
-
July 18, 2014 at 02:35 #22919kpkrewParticipant
When I first set up this site I was making it a paid site and had some custom code added to my functions.php so that the site would not display people who were not on a paid plan.
I am making the site free to all but when iI simply disabled the payements plugin the people that have already signed up didnt display , I believe it is because of some of the custom code but I have quite a bit of custom stuff and not 100% sure which part of the code to take out
here is my custom functions file , I would appreciate if you could have a quick look and stear me in the right direction
cheers
COPY CODE<?php /** * @package WordPress * @subpackage Sweetdate * @author SeventhQueen <themesupport@seventhqueen.com> * @since Sweetdate 1.0 */ /** * Sweetdate Child Theme Functions * Add extra code or replace existing functions */ add_action('after_setup_theme','kleo_my_hearts_actions'); function kleo_my_hearts_actions() { /* disable matching on member profile */ remove_action('kleo_bp_before_profile_name', 'kleo_bp_compatibility_match'); /* disable matching on member profile */ remove_action('kleo_bp_before_profile_name', 'kleo_bp_compatibility_match'); /* Replace the heart over images */ add_filter('kleo_img_rounded_icon', 'my_custom_icon'); /* Replace the heart from register modal */ add_filter('kleo_register_button_icon', 'my_custom_icon_register'); /* Replace the heart from About us widget */ add_filter('kleo_widget_aboutus_icon', 'my_custom_icon_about_widget'); } //members page fields add_action('after_setup_theme','kleo_my_member_data'); function kleo_my_member_data() { global $kleo_config; //this is the details field, right now it take the "About me" field content $kleo_config['bp_members_details_field'] = 'About me'; //this display the fields under the name, eq: 36 / Woman / Divorced / Berlin. Modify with the names of the fields you want to appear there $kleo_config['bp_members_loop_meta'] = array( 'Profile Type', 'Position Played' ); } add_filter('buddyblog_show_posts_on_profile','__return_true'); //Code to remove hearts /* Replace the heart with a camera icon function */ function my_custom_icon () { return 'camera'; } /* Replace the heart from register modal with a user icon function */ function my_custom_icon_register () { return 'user'; } /* Replace the heart from about us widget with a user icon function */ function my_custom_icon_about_widget () { return 'user'; } //code to dispaly tabs beside avatar { global $bp_tabs; $bp_tabs = array(); $bp_tabs['base'] = array( 'type' => 'regular', 'name' => apply_filters('kleo_extra_tab2',__('About me', 'kleo_framework')), 'group' => 'Base', 'class' => 'regulartab' ); $bp_tabs['my-sport'] = array( 'type' => 'regular', 'name' => __('My Sport', 'kleo_framework'), 'group' => 'My Sport', 'class' => 'regulartab' ); $bp_tabs['myself-summary'] = array( 'type' => 'regular', 'name' => __('Summary', 'kleo_framework'), 'group' => 'Myself Summary', 'class' => 'regulartab' ); /* rtMedia tab - only if plugin installed */ if (class_exists('RTMedia')) { $bp_tabs['rtmedia'] = array( 'type' => 'rt_media', 'name' => __('My photos', 'kleo_framework'), 'class' => 'mySlider' ); } /* Bp-Album tab - only if plugin installed */ elseif (function_exists('bpa_init') AND sq_option('bp_album', 1) == 1) { $bp_tabs['bp-album'] = array( 'type' => 'bp_album', 'name' => __('My photos', 'kleo_framework'), 'class' => 'mySlider' ); } $bp_tabs['looking-for'] = array( 'type' => 'cite', 'name' => apply_filters('kleo_extra_tab1', __('Looking for', 'kleo_framework')), 'group' => apply_filters('kleo_extra_tab1', 'Looking for'), 'class' => 'citetab' ); } /** * Get users with specified membership * @param array $membership * @return array */ function get_membership_users($memberships) { global $wpdb; $sqlQuery = "SELECT u.ID FROM $wpdb->users u LEFT JOIN $wpdb->pmpro_memberships_users mu ON u.ID = mu.user_id LEFT JOIN $wpdb->pmpro_membership_levels m ON mu.membership_id = m.id"; $sqlQuery .= " WHERE mu.membership_id > 0 AND mu.status = 'active' "; if($l) $sqlQuery .= " AND mu.membership_id IN (" . join(" , ",$memberships) . ") "; $sqlQuery .= "GROUP BY u.ID"; $sqlQuery = apply_filters("pmpro_members_list_sql", $sqlQuery); $theusers = $wpdb->get_results($sqlQuery); $data = array(); if ($theusers) { foreach ($theusers as $usr) { $data[] = $usr->ID; } } return $data; } //Change your membership levels ID - instead of level 1 and level 2 global $my_paying_users; $my_paying_users = get_membership_users(array(1,2)); //Hide recent user add_action('bp_init', 'kleo_private_members'); function kleo_private_members(){ global $bp, $my_paying_users; if ( ! in_array($bp->loggedin_user->id, $my_paying_users) ) { remove_action("wp_head","bp_core_record_activity"); //id SM is on, remove the record activity hook //then remove the last activity, if present delete_user_meta($bp->loggedin_user->id, 'last_activity'); } } //Hide member in Members directory page add_action('bp_ajax_querystring','kleo_exclude_users',20,2); function kleo_exclude_users($qs=false,$object=false) { global $my_paying_users; $included_user=implode(",",$my_paying_users); if($object!='members')//hide for members only return $qs; $args=wp_parse_args($qs); //check if we are listing friends?, do not exclude in this case if(!empty($args['user_id'])) return $qs; if(!empty($args['include'])) $args['include']=$args['include'].','.$included_user; else $args['include']=$included_user; $qs=build_query($args); return $qs; } /** * END Hide Admin */ // Hide admin profile pages add_action( 'wp', 'hide_profile_template', 1 ); function hide_profile_template() { global $bp, $my_paying_users; if(!bp_is_my_profile() && bp_is_member()) : if (! in_array($bp->displayed_user->id,$my_paying_users)): global $wp_query; $wp_query->set_404(); status_header(404); include(locate_template('404.php')); exit; endif; endif; } //hide friends nav function my_remove_friends_nav() { global $bp; if (!bp_is_my_profile()) { bp_core_remove_nav_item( 'friends' ); } } add_action( 'bp_setup_nav', 'my_remove_friends_nav' ); ?>
July 22, 2014 at 17:25 #23204CatalinModeratorHello,
Add this instead:
COPY CODE<?php /** * @package WordPress * @subpackage Sweetdate * @author SeventhQueen <themesupport@seventhqueen.com> * @since Sweetdate 1.0 */ /** * Sweetdate Child Theme Functions * Add extra code or replace existing functions */ add_action('after_setup_theme','kleo_my_hearts_actions'); function kleo_my_hearts_actions() { /* disable matching on member profile */ remove_action('kleo_bp_before_profile_name', 'kleo_bp_compatibility_match'); /* disable matching on member profile */ remove_action('kleo_bp_before_profile_name', 'kleo_bp_compatibility_match'); /* Replace the heart over images */ add_filter('kleo_img_rounded_icon', 'my_custom_icon'); /* Replace the heart from register modal */ add_filter('kleo_register_button_icon', 'my_custom_icon_register'); /* Replace the heart from About us widget */ add_filter('kleo_widget_aboutus_icon', 'my_custom_icon_about_widget'); } //members page fields add_action('after_setup_theme','kleo_my_member_data'); function kleo_my_member_data() { global $kleo_config; //this is the details field, right now it take the "About me" field content $kleo_config['bp_members_details_field'] = 'About me'; //this display the fields under the name, eq: 36 / Woman / Divorced / Berlin. Modify with the names of the fields you want to appear there $kleo_config['bp_members_loop_meta'] = array( 'Profile Type', 'Position Played' ); } add_filter('buddyblog_show_posts_on_profile','__return_true'); //Code to remove hearts /* Replace the heart with a camera icon function */ function my_custom_icon () { return 'camera'; } /* Replace the heart from register modal with a user icon function */ function my_custom_icon_register () { return 'user'; } /* Replace the heart from about us widget with a user icon function */ function my_custom_icon_about_widget () { return 'user'; } //code to dispaly tabs beside avatar { global $bp_tabs; $bp_tabs = array(); $bp_tabs['base'] = array( 'type' => 'regular', 'name' => apply_filters('kleo_extra_tab2',__('About me', 'kleo_framework')), 'group' => 'Base', 'class' => 'regulartab' ); $bp_tabs['my-sport'] = array( 'type' => 'regular', 'name' => __('My Sport', 'kleo_framework'), 'group' => 'My Sport', 'class' => 'regulartab' ); $bp_tabs['myself-summary'] = array( 'type' => 'regular', 'name' => __('Summary', 'kleo_framework'), 'group' => 'Myself Summary', 'class' => 'regulartab' ); /* rtMedia tab - only if plugin installed */ if (class_exists('RTMedia')) { $bp_tabs['rtmedia'] = array( 'type' => 'rt_media', 'name' => __('My photos', 'kleo_framework'), 'class' => 'mySlider' ); } /* Bp-Album tab - only if plugin installed */ elseif (function_exists('bpa_init') AND sq_option('bp_album', 1) == 1) { $bp_tabs['bp-album'] = array( 'type' => 'bp_album', 'name' => __('My photos', 'kleo_framework'), 'class' => 'mySlider' ); } $bp_tabs['looking-for'] = array( 'type' => 'cite', 'name' => apply_filters('kleo_extra_tab1', __('Looking for', 'kleo_framework')), 'group' => apply_filters('kleo_extra_tab1', 'Looking for'), 'class' => 'citetab' ); } //hide friends nav function my_remove_friends_nav() { global $bp; if (!bp_is_my_profile()) { bp_core_remove_nav_item( 'friends' ); } } add_action( 'bp_setup_nav', 'my_remove_friends_nav' ); ?>
Let me know if this works.
Thank you,
CatalinHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
The topic ‘reverting back to free’ is closed to new replies.