This topic has 6 replies, 2 voices, and was last updated 9 years by Radu.

  • Author

    Tagged: 

  • #82029
     Oscar570
    Participant

    Hi,

    I created differents levels for my website.(SILVER, GOLD AND PLATINUM)

    The users must paid for each level. I bought Cometchat. How can I give acces to users for using Cometchat via Theme Options > Memberships for GOLD AND PLATINUM LEVELS ?

    Thanks a lot for your help.

    Regards,

    Nathalie

    #82259
     Radu
    Moderator

    Hi,

    Use add this php code to your kleo-child/functions.php

    COPY CODE
    
    function CheckMemberships() {
    
    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', 'CheckMemberships');
    

    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.

    Best Regards

    Radu

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

    Thnaks a lot for your help !
    Nathalie

    #82289
     Oscar570
    Participant
    This reply has been set as private.
    #82400
     Radu
    Moderator

    Hi,

    The solution that i have you provided it allows you to load the cometchat only for the mentioned level ID’s that are written here

    COPY CODE
    
    if(pmpro_hasMembershipLevel(array(1,2,3), get_current_user_id()))
    

    Where 1,2,3 are the memberships packs ID’s.

    This is manually created code snipped and it will not provide you any additional settings in theme options panel.

    Cheers

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

    ok Radu.

    For me :
    ID 1 = level SILVER
    ID 2 = level GOLD
    ID 3 = level PLATINUM.

    So I’d like the users from levels gold and platinum have an access for Cometchat and not users’ level silver.
    So I deleted ID 1.
    Is it correct ? Certainly not because nothing has changed…. 🙁

    ——–
    function CheckMemberships() {

    if(pmpro_hasMembershipLevel(array(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’, ‘CheckMemberships’);

    ——–

    #82732
     Radu
    Moderator

    Hi,

    With the code provided below the chat will be loaded only for memberships ID’s 2 and 3.

    COPY CODE
    
    function CheckMemberships() {
     
    if(pmpro_hasMembershipLevel(array(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', 'CheckMemberships');
    

    Please understand this is a custom implementation you should probably hire a developer to can help with your desired requirements.

    Cheers

    Radu

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

The forum ‘Plugins questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?