Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • in reply to: Total Men and Women Numbers #9664
     frien337
    Participant

    Thanks Abe. I wanted to still have the same icons that show for the member stats on the welcome page (Members in total, Men online, etc.).

    I figured out a way how to do this but it may be a bit of a dirty workaround as it involves editing one of the core files, so let me know if there is a better way. If anyone wants to know, the way I got Total Men and Total Woman (signed up, not online) to show in the Welcome page’s icons is by doing this:

    1:Open the bp-functions.php file (ftp://yoursite.com/wp-content/themes/sweetdate/custom_buddypress/bp-functions.php) and find this bit of code:

    COPY CODE
    
    if (!function_exists('kleo_member_stats')) {
        function kleo_member_stats( $atts, $content = null ) {
    		extract(shortcode_atts(array(
    			'field' => '',
    			'value' => ''
    	    ), $atts));
            
            return bp_member_statistics($field, $value);
        }
        add_shortcode('kleo_member_stats', 'kleo_member_stats');
    }
    

    Cut it out of the document and past it above this bit of code:

    COPY CODE
    
    if (!function_exists('kleo_status_icon')) {
    	function kleo_status_icon( $atts, $content = null ) {
    
    		extract(shortcode_atts(array(
    			'type' => 'total',
    			'image' => '',
    			'subtitle' => '',
    			'class' => ''
    	    ), $atts));
    
    		switch ($type) {
    

    Scroll down and find this bit of code:

    COPY CODE
    
    			case 'women_online':
    				$image = ($image == '')? get_template_directory_uri().'/assets/images/icons/steps/status_03.png' : $image;
    				$number = bp_get_online_users("Woman");
    

    And replace it with:

    COPY CODE
    
    			case 'women_online':
    				$image = ($image == '')? get_template_directory_uri().'/assets/images/icons/steps/status_03.png' : $image;
    				$number = do_shortcode('[kleo_member_stats field="I am a" value="Woman"]');
    				$subtitle = 'Total Women';
    

    The field must match your user profile fields. So, for the bit of text above ” field=”I am a” value=”Woman” “, the “field” refers to the name of your sex field (e.g.: “I am a” or “sex”) and the “value” refers to the value of your sex field (e.g.: male or female). The $subtitle = ‘Total Women’; is the label of the statistic on the welcome page with ‘Total Women’ being the text that is displayed.

    We need to do the same for the total of men that have signed up. Find this bit of code:

    COPY CODE
    
    			case 'men_online':
    				$image = ($image == '')? get_template_directory_uri().'/assets/images/icons/steps/status_04.png' : $image;
    				$number = bp_get_online_users("Man");
    

    And replace it with:

    COPY CODE
    
    			case 'men_online':
    				$image = ($image == '')? get_template_directory_uri().'/assets/images/icons/steps/status_04.png' : $image;
    				$number = do_shortcode('[kleo_member_stats field="I am a" value="Man"]');
    				$subtitle = 'Total Men';
    

    Save the file and refresh your home page and you will now see those icon stats showing total members, total men, total women, and total members online.

    in reply to: Name Field on Register Form #9533
     frien337
    Participant

    Thanks Abe, this has worked perfectly. I just had to make a small change by adding in a “/” before the “register/” text. Here’s the updated one for anyone who needs this:

    COPY CODE
    
    <script>
    var url = document.location.href;
    jQuery(document).ready(function() {
    //copy profile name to account name during registration
    if (url.indexOf("/register/") >= 0) {
        jQuery('label[for=field_1],#field_1, #field-visibility-settings-toggle-1').css('display','none');
        jQuery('#signup_username').blur(function(){
            jQuery("#field_1").val(jQuery("#signup_username").val());
        });
    }
    });
    </script>
    
Viewing 2 posts - 1 through 2 (of 2 total)

Log in with your credentials

Forgot your details?