This topic has 7 replies, 3 voices, and was last updated 7 years by Radu.

  • Author
  • #100907
     nravinaidu
    Participant

    I have to enable chat option with friends in their profile

    How can i Enable with membership restrictions in KLEO theme

    #101015
     Radu
    Moderator

    Hi,

    For the chat question follow this topic : https://archived.seventhqueen.com/forums/topic/chatting-option-for-chat-to-friends-user-with-each-other

    2. https://archived.seventhqueen.com/documentation/kleo#memberships

    Cheers

    Radu

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

    I need the chat plugin like, If the user is having paid membership only can chat with their friends,

    Kindly suggest any plugin like that plss

    #101172
     Radu
    Moderator

    Hi,

    From example if you will use comet-chat plugin # https://www.cometchat.com/demo

    With this function that you will need to add it to wp-content/themes/kleo-child/functions.php the chat will be available only for the users that have memberships packages ID’s : 1, 2 and 3

    COPY CODE
    
    
    function ChatCheckMemberships() {
     
    if(pmpro_hasMembershipLevel(array(1,2,3), get_current_user_id())){
        echo '
    <link type="text/css" href="/cometchat/cometchatcss.php" rel="stylesheet" charset="utf-8"/>
    <script type="text/javascript" src="/cometchat/cometchatjs.php" charset="utf-8"></script>
    ';}
    }
    add_action('wp_head', 'ChatCheckMemberships')
    

    if(pmpro_hasMembershipLevel(array(1,2,3)

    1,2,3 represents the membership package id, you can add more or less packages.

    Now the cometchat widget will be loaded only if logged user has one of that memberships id.

    Cheers

    Radu

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

    Hello i tryed to add the code for arrow chat so i wrote the code with the right path as you can see below :

    COPY CODE
    function ChatCheckMemberships() {
     
    if(pmpro_hasMembershipLevel(array(2), get_current_user_id())){
        echo '
    <link type="text/css" href="/arrowchat/public/list/css/style.css" rel="stylesheet" charset="utf-8"/>
    <script type="text/javascript" src="/arrowchat/public/list/js/list_core.js" charset="utf-8"></script>
    ';}
    }
    add_action('wp_head', 'ChatCheckMemberships')

    But actually isnt working and my website isnt accessible anymore with this code, the problem seem located on the last line : add_action('wp_head', 'ChatCheckMemberships') when i remove this line its okay the site is accessible again. So i wonder if this line is usefull or not ?
    ps : Im using sweetdate theme

    #148741
     Radu
    Moderator

    Hi,

    There are missing ; at the end of this add_action(‘wp_head’, ‘ChatCheckMemberships’)

    Add ; and let me know

    Cheers
    R.

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

    Yeah indeed its working now thank you 🙂

    So i have another problem maybe you can help me 🙂 Its about the code for get free male membership :

    COPY CODE
    function kleo_pmpro_default_level($user_id) {
        global $wpdb, $bp;
     
        //Change this with your field name
        $field_name= "I am a";
     
        //Change the field value
        $value_to_match = "Woman";
     
        //Membership level id
        $membership_level = 1;
     
        //Done editing
        $field_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s", $field_name ) );
        if ($_POST['field_'.$field_id] == $value_to_match) {
                pmpro_changeMembershipLevel($membership_level, $user_id);
        }
    }
     
    function kleo_mu_pmpro_default_level($user_id, $password, $meta) {
        global $bp, $wpdb;
     
        //Change this with your field name
        $field_name= "I am a";
     
        //Change the field value
        $value_to_match = "Man";
     
        //Membership level id
        $membership_level = 1;
     
        
        //Done editing
        $field_id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$bp->profile->table_name_fields} WHERE name = %s", $field_name ) );
        $field_value = $meta['field_'.$field_id];
        if ( $field_value == $value_to_match ) {
            pmpro_changeMembershipLevel($membership_level, $user_id);
        }
    }
     
    if (is_multisite()) {
        add_action( 'wpmu_activate_user', 'kleo_mu_pmpro_default_level', 10, 3);
    } else {
        add_action('user_register', 'kleo_pmpro_default_level');
    }

    This code is for set man members as free membership if i understood. Actually i have two rank in paid membership the first is called “VIP” and second “Regular members” so i would like to set all woman as “VIP” and man as “Regular members”. Can you tell me how to change this code for get that ?
    Thank you

    #149286
     Radu
    Moderator

    Hi,

    For testing and inspecting what’s wrong with that code it require some time, since this isn’t a theme problem i cannot help you to make this work right now, i hope you understand

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?