This topic has 5 replies, 4 voices, and was last updated 9 years by adamdale1.

  • Author
  • #46978
     adamdale1
    Participant

    Sweetdate, Excellent theme & well documented! Spent the last three months working on coding. Been on a steep learning curve, never touched PHP till now. I have three (3) questions.
    May have been asked before in the forum, but can’t find any reference to it!
    I’ve created another gender “Couple”, with new .png, searched for, modified and created new code.

    The whole site is working well, except for the Home page(front page)

    Total members =3, consisting of Woman = 1, Man =1 & Couple =1, but in the display you see it displays Couples online 3. see attachment
    I modified bp-functions with the following code:

    $sex_type = array(__(‘Man’, ‘kleo_framework’), __(‘Woman’, ‘kleo_framework’), __(‘Couple’, ‘kleo_framework’));

    case ‘couples_online’:
    $image = ($image == ”)? get_template_directory_uri().’/assets/images/icons/steps/status_05.png’ : $image;
    $number = bp_get_total_member_count(“Couple”);
    break;

    1st Question? Is the above code correct to work? From what I’ve picked up it is or have I’ve missed something?

    if ($type == ‘Man’) {
    $image = ($image == ”)? get_template_directory_uri().’/assets/images/icons/steps/status_04.png’ : $image;
    } elseif($type == ‘Woman’) {
    $image = ($image == ”)? get_template_directory_uri().’/assets/images/icons/steps/status_03.png’ : $image;
    } else {
    $image = ($image == ”)? get_template_directory_uri().’/assets/images/icons/steps/status_05.png’ : $image;
    }
    2nd Question follwing ?? Correct? Or does else require else($type == ‘Couple’)
    above?

    I added the following function.

    if (!function_exists(‘kleo_couples_online’)) {
    function kleo_couples_online( $atts, $content = null ) {
    $field = ”;
    extract(shortcode_atts(array(
    ‘field’ => ‘Couple’,
    ), $atts));
    return bp_get_online_users($field);
    }
    add_shortcode(‘kleo_couples_online’, ‘kleo_couples_online’);
    }

    3rd, I’ve been through all the code and found one item where I added a section, but now can’t find it again, all I remember was that it set the display to zero for couples online with >0<, any help to get front page up and going would be greatly appreciated, for then the site will be completed. I can’t continue until this is rectified! And I’m sure that there are many others that your response could help too.

    #47035
     adamdale1
    Participant

    Thank you, for the replies, look like I just needed that break from looking at the code, when I came back to it, I found the problem, fixed it & tested it, it all works, now I know I can add as many genders(sexes) as I want and have it working!

    #47072
     Laura
    Moderator

    Glad you solved it!

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

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #48328
     Darkarcher
    Participant

    Was wondering if you could share how you resolved your issue? Would be greatly appreciated.

    #51021
     subwolf
    Participant

    hi i would like to know as well created another gender “Couple”, with new .png how ??on homepage

    Attachments:
    You must be logged in to view attached files.
    #51033
     adamdale1
    Participant

    In reply to darkarcher & subwolf, be careful how you use “Couple” is the gender and “couple” used in code!

    Added the “Couple” to the ‘’Iam a’ under the wp-admin, Users, Profile Fields!

    Created a new icon ‘status_05.png’ and stored it in /assets/images/icons/steps/status_05.png,

    In line 210
    $sex_type = array(__(‘Man’, ‘kleo_framework’), __(‘Woman’, ‘kleo_framework’));
    changed to
    $sex_type = array(__(‘Man’, ‘kleo_framework’), __(‘Woman’, ‘kleo_framework’), __(‘Couple’, ‘kleo_framework’));

    then again in line 238

    learnt about the if/else/else php command and searched for “Woman”in bp-function
    At line 1340 added

    case ‘couples_online’:
    $image = ($image == ”)? get_template_directory_uri().’/assets/images/icons/steps/status_05.png’ : $image;
    $number = bp_get_online_users(“Couple”);
    break;

    @ 1343 added function

    if (!function_exists(‘kleo_couples_online’)) {
    function kleo_couples_online( $atts, $content = null ) {
    $field = ”;
    extract(shortcode_atts(array(
    ‘field’ => ‘Couple’,
    ), $atts));
    return bp_get_online_users($field);
    }
    add_shortcode(‘kleo_couples_online’, ‘kleo_couples_online’);
    }

    @ 1344 added the following to tie it into sweetdate

    default:
    if ($type == ‘Man’) {
    $image = ($image == ”)? get_template_directory_uri().’/assets/images/icons/steps/status_04.png’ : $image;
    } elseif($type == ‘Woman’) {
    $image = ($image == ”)? get_template_directory_uri().’/assets/images/icons/steps/status_03.png’ : $image;
    } else {
    $image = ($image == ”)? get_template_directory_uri().’/assets/images/icons/steps/status_05.png’ : $image;
    }
    $number = bp_get_online_users($type);
    break;

    the final @ 1344 assumes that if it not a man or woman then it must be a couple
    that’s it!
    By the way am posting a question about user avatars, have worked out a solution to gender specific avatars but don’t understand the coding in sweetdate so can’t implement it till I do!

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

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

Log in with your credentials

Forgot your details?