-
Author
-
January 28, 2016 at 09:22 #100907nravinaiduParticipant
I have to enable chat option with friends in their profile
How can i Enable with membership restrictions in KLEO theme
January 28, 2016 at 18:11 #101015RaduModeratorHi,
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 solutionJanuary 29, 2016 at 11:27 #101126nravinaiduParticipantI 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
January 29, 2016 at 16:46 #101172RaduModeratorHi,
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 CODEfunction 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 solutionJanuary 4, 2017 at 06:57 #148675vulkashParticipantHello i tryed to add the code for arrow chat so i wrote the code with the right path as you can see below :
COPY CODEfunction 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 themeJanuary 4, 2017 at 18:20 #148741RaduModeratorHi,
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 solutionJanuary 6, 2017 at 04:22 #149050vulkashParticipantYeah 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 CODEfunction 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 youJanuary 9, 2017 at 19:28 #149286RaduModeratorHi,
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 -
AuthorPosts
You must be logged in to reply to this topic.