Jump to content

Set Cometchat for specific IPB groups only


Janyour

Recommended Posts

Hello everybody,

We are using cometchat with our IPBoard since few days, looks really great and our members appreciate it.

We are looking to set it for a premium group on our IPBOARD, we contacted the cometchat support and they told us how to but looks little bit hard to do, here's their response :

Quote

Hello,

The getUserID() function inside '/cometchat/integration.php' file returns the userid of logged-in users. Please go through the following steps to disable CometChat for certain user groups.

1. In getUserID() function just above the return statement write a query which will fetch user group of the currently logged-in users.
2. If the current user is in the group for whom you want to disable CometChat then return '0' as userid of those users else return the userid of currently logged-in users.
3. This will hide CometChat bar for the user group for whom you want to disable CometChat.

 

Any idea ? If you need the cometchat files in cand send them.

 

/* FUNCTIONS */

	function getUserID() {
		$userid = 0;
		if (!empty($_SESSION['basedata']) && $_SESSION['basedata'] != 'null') {
			$_REQUEST['basedata'] = $_SESSION['basedata'];
		}
		if (!empty($_REQUEST['basedata'])) {
			if (function_exists('mcrypt_encrypt') && defined('ENCRYPT_USERID') && ENCRYPT_USERID == '1') {
				$key = "";
				if( defined('KEY_A') && defined('KEY_B') && defined('KEY_C') ){
					$key = KEY_A.KEY_B.KEY_C;
				}
				$uid = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode(rawurldecode($_REQUEST['basedata'])), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
				if (intval($uid) > 0) {
					$userid = $uid;
				}
			} else {
				$userid = $_REQUEST['basedata'];
			}
		}
		if (isset($_COOKIE['ips4_member_id']) && empty($userid)) {
			$userid = $_COOKIE['ips4_member_id'];
		}
		$userid = intval($userid);
		return $userid;
	}

 

integration.php

Link to comment
Share on other sites

I just do this in the IPB global template so it only loads scripts for certain groups and if they are not banned. So something like:

{{if !member.temp_ban and in_array(member.member_group_id, array('3','4','6','7','8'))}}
....replace with your group numbers above in the array to have access and put scripts here that load the bar....
{{endif}}

 

Link to comment
Share on other sites

@MADMAN32395 thank you, we are looking how to hide cometchat from non-premium members :)

@prupdatedthank you, its a good idea,j i am just tried it and its working  ! the problem is that our forum visitors will not see this feature, only a specifi group will see it !

i was wondering if there is a way to show the chat without using it for non premium membersd !? you think its possible and easy to do ?

Link to comment
Share on other sites

4 hours ago, Janyour said:

i was wondering if there is a way to show the chat without using it for non premium membersd !? you think its possible and easy to do ?

Not that I know of offhand. That probably requires editing the cometchat files. Maybe you could just put a banner or something showing non premium members what they're missing out on. Besides, for load purposes, I generally avoid showing the bar to anyone who can't actually use it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...