This topic has 4 replies, 3 voices, and was last updated 10 years by frien337.

  • Author
  • #9548
     frien337
    Participant

    Hello Everyone,

    Is there a way to shows only the total number of women and men (separately) who have signed up? I see there is the shortcode to show the number of women/men online, but I could find anything too show only the amount who have signed up.

    Many thanks,
    Ryan

    #9552
     nusolutions
    Participant

    Good question. I’d like to see that too.

    #9611
     Abe
    Keymaster

    You can use the statistics shortcode: [kleo_member_stats field=”” value=””]
    field – Your profile field name
    value – the value you want to count users for

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #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.

    #9665
     frien337
    Participant

    obviously copy and paste the code with out the < code> and < /code> tags 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?