Important Notice: Effective immediately, all support will be handled through Discord. Read more about the changes coming to Anodyne's services.

iFlyChat integration

TheDrew Mon Nov 14, 2016 11:12 pm

iFlyChat integration

I'll hopefully be posting some proof of concept work for this in Nova 2 but please consider iFlyChat integration in Nova 3. iFlyChat is a php based chat system that works really well with Nova 2 and allows for social interaction between site visitors (both current and potential writers). It comes in a free version that is limited to 10 simultaneous online users, above that is for pay but it's good for most

I use it on two sites I admin and it's done wonders for getting crew to interact and write together. As well, guests who poke through the site often end up interacting with online crew and that has been amazing from a recruitment standpoint.

Posts: 29

TheDrew Mon Nov 28, 2016 1:46 pm

Re: iFlyChat integration

So this is the basic code I use to integrate iFlyChat into Nova. This goes into the skin files in the php section above the html block. Please note this is a bit rough as I've grabbed various routines from CodeIgnitor and violated the MVC concept all over the place but it works. If someone wants to clean it up so it fits better into the MVC model, go ahead. I will also note this is tested on 2.3.2 but not 2.4.x so YMMV.

Code: Select all
//iflychat code
const APP_ID = 'supplied_by_iflychat';
const API_KEY =  'supplied_by_iflychat';

if (Auth::is_logged_in()) //Is user logged into the site?
   //Determine Admin Status
   $role = $this->user->get_user($this->session->userdata('userid'), array('access_role'));
   if ($role['access_role'] == 1) { $is_admin = TRUE; }
   //Generate Character name for chat
   $chat_name = $this->char->get_character_name($this->session->userdata('main_char'));
   //Generate Avatar link
   $char_images = $this->char->get_character($this->session->userdata('main_char'),array('images'));
   $avatar = explode(',', $char_images['images']);
   if ( empty($avatar[0]) ){ $avatar_url = 'path_to_generic_image'; }
   else { $avatar_url = 'http://path_to_your_avatars/' . $avatar[0]; }
   //Intialize Chat
   $iflychat = new \Iflylabs\iFlyChat(APP_ID, API_KEY);
   //Set User details
         'user_id' => $this->session->userdata('userid'),
         'user_name' => $chat_name,
         'is_admin' => $is_admin,
         'user_avatar_url' => $avatar_url,
         //'user_profile_url' => $chat_profile,
         'is_mod' => FALSE
   $iflychat = new \Iflylabs\iFlyChat(APP_ID, API_KEY);

$ifly_html_code = $iflychat->getHtmlCode();

Posts: 29

AgentPhoenix Mon Nov 28, 2016 2:08 pm

Re: iFlyChat integration

This might be something we can work on together in the coming months to see if it's feasible to be in the core or if it's better suited for an extension. We can take this offline if you want to just shoot me some contact information for you through PM (email or IM). Thanks for hacking away on this one!
User avatar

Posts: 7596

Return to Nova NextGen

Who is online

Users browsing this forum: No registered users and 1 guest