solved Mutual Follow "Friends" button - plus Message

PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
Hey Everyone :)

I am looking to make a couple small changes to the jrFollower module.

#1. When looking at modules/jrFollower/templates/button_following.tpl

What would be the proper {if} statement to determine if user_following AND user_follow_back? I would like the button to show "friends" if it meets this criteria.

#2. I also have a small piece of code from CometChat that I would like to add so that a [Message] button appears next to the [Friends] button when this same "mutual follow" criteria is met. The message button needs to trigger some code like this
<a href="javascript:void(0)" onclick="javascript:jqcc.cometchat.chatWith({$profile_name});">Message</a>

Any ideas?


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3

updated by @the-patria-company: 06/03/16 10:53:46AM
paul
@paul
8 years ago
4,326 posts
Try this for the jrFollower following.tpl template -

{$_f = jrFollower_get_users_following($_user._profile_id)}
{jrCore_module_url module="jrFollower" assign="murl"}
{if isset($_items)}
{foreach $_items as $item}

    {if $item@first || ($item@iteration % 6) == 1}
    <div class="row">
    {/if}

    {if ($item@iteration % 6) === 0}
        <div class="col2 last">
    {else}
        <div class="col2">
    {/if}

        <div class="p5 center" style="position:relative">
            <a href="{$jamroom_url}/{$item.profile_url}">{jrCore_module_function function="jrImage_display" module="jrProfile" type="profile_image" item_id=$item._profile_id size="large" crop="auto" class="img_scale" width=false height=false alt="{$txt|jrCore_entity_string}" title="{$txt|jrCore_entity_string}"}</a><br><a href="{$jamroom_url}/{$item.profile_url}">@{$item.profile_url}</a>
            {if isset($_f["`$item["_user_id"]`"])}
                &nbsp;(Friends - <a href="javascript:void(0)" onclick="javascript:jqcc.cometchat.chatWith({$_f["`$item["_user_id"]`"]});">Message</a>)
            {/if}
            <br>
        </div>

        </div>

    {if ($item@iteration % 6) === 0 || $item@last}
    <div style="clear:both"></div>
    </div>
    {/if}

{/foreach}
{/if}
It calls the jrFollower_get_users_following() function to get an array ($_f) of who is following the profile then checks that array for 'followees' inside the loop and if found adds in the 'friends' and 'message' link.
hth


--
Paul Asher - JR Developer and System Import Specialist
PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
Thank you Paul :)

I like it and am going to keep it. Although there is an issue with the CometChat javascript that I already have a ticket into them to assist with. I will post the updated working code for everyone once I have it up and running.

If we took this one step further. How can we use the jrFollower_get_users_following to check the "followee" status of a profile that you are currently viewing? I can see other applications, including this being a very positive timeline status update when someone reciprocates a follow (ie. "Joe and Dave just confirmed their friendship :)") Good feelings make a successful website.

Thanks again for the help.


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3
Strumelia
Strumelia
@strumelia
8 years ago
3,603 posts
I'm not so much interested in the 'cometchat message' part of this being applied on my site, but I think the ability to quickly and easily know/see whether someone you are following is following you back and changes to a 'friend' would be a WONDERFUL improvement for Jamroom. It's something I've actually missed from back in Ning, and continues to confuse my members.
Think of it this way- if you are 'following' someone who's walking along the beach, they may not notice you're following them even though you're throwing pebbles at them to get their attention, and of course it's hard to talk with them. If on the other hand they stop, wait for you and you both start walking together, you are then 'friends' rather than merely followers and can communicate easily. Being friends is different from being a follower.
On jamroom there is no ONE place where one can obviously see that the connection circuit is complete from both parties. You can be someone's 'follower' forever but they can still not be following you and so you can't communicate as 'friends'.
In ning if someone 'followed' you, instead of a passive notification that merely shows they are following you, you'd get an INVITATION link to follow them back and become Friends. You could ignore the invitation or click it to quickly complete the circuit. Jamroom sends you a notice that someone has started following you- but there's no action link included in the notice to facilitate completing the connection both ways, and there's no visible differentiation between a one way follow and a two way completed connection.

If there was a new button or indicator that readily shows once a member is now your 'friend' (following connection has been completed both ways), then you would right away know the you are BOTH now following each other and private contact is possible. Also would love to see a QUICK ACTION LINK in the 'following' notification that enables one to instantly follow the person back, right from the notification link.
My members would definitely welcome this!


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
brian
@brian
8 years ago
10,148 posts
This is pretty much already supported by Jamroom:

- You can easily view WHICH profiles you are following (as a user) by clicking on the "Profiles you Follow" option in the user menu

- You can easily see which USERS are following your active profile by clicking on the "followers" profile menu option.

One of the issues here is that Jamroom is not a 1 to 1 system (1 user to 1 profile) - it can be 1 user to multiple profiles, or multiple profiles to 1 user. Users follow profiles - not users.

This is why the users that follow a profile are shown in the PROFILE menu, while profiles a user follows is shown in the USER menu.

The one thing we could do here is have some type of indicator on the profile followers page whether or not the viewing user (if they are the profile owner) is following that user's profile. Would need to be handled via JS though, and not in a template, since the followers page is cached and on a profile with multiple users this would be a problem.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

updated by @brian: 01/30/16 09:20:54AM
Strumelia
Strumelia
@strumelia
8 years ago
3,603 posts
The problem is that it requires a member to click on two different places to see if A) they are following someone, and then B) if that person is also following them back. Many of my members can't keep this all straight.
What I'd love to see is if i (as a regular member) go to another member's profile page and see a little green dot light or something underneath their profile picture with the word "friend" next to it -that indicates to me once we are BOTH following each other and can send private messages. Something like one sees with those little 'online now' green light dots...but telling me we are now co-followers...i.e. 'friends'.
Having an indicator on another person's profile page tell me (as the viewer) simply that I'm following someone (a one way follow) would actually make it MORE confusing on my site- my members would then think the follow was going both ways already...and they'd start asking me why they can't PM that person.
I think that in addition to this clicking around to get 'following' statuses from separate places, there just needs to be a visual indicator icon that automatically shows when you are on a member page where you are BOTH already following each other and the circuit is complete...and that icon needs to visually suggest a 'friend' type of connection somehow...to differentiate it from a one way follow.

And, there ought to be a direct invitation link in the 'new follower' notifications that takes you right to where you can reciprocate the follow if you like, along with specific instructions on following that member back to become 'friends'.
My members continue to have a hard time with the following concept as two separate actions and two directions. --> They think that by simply ACCEPTING (allowing) a new follower, they are now 'friends' and can PM...when in fact they've totally missed the part where they need to actively go follow that person back first. This happens over and over despite my repeatedly describing out how it works. It's non-intuitive and not simple or obvious to them.


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
brian
@brian
8 years ago
10,148 posts
Jamroom uses a "followers" model - not a "friends" model - maybe that's part of the confusion?


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
Strumelia
Strumelia
@strumelia
8 years ago
3,603 posts
Yes it's definitely part of the confusion, for my members. Took me a little while to figure it out and get used to it myself, but my members tend to be older and not so quick in having to click to various places to get the 'whole picture' (the follow going two different ways).


--
...just another satisfied Jamroom customer.
Migrated from Ning to Jamroom June 2015
PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
This is a great conversation :)

It is interesting to note that I have paid for services that give me this information from my twitter accounts. Although I really dislike having "another" place to go to get the info, it is very important. I do see this as time well spent for Jamroom to excel past Twitter, Youtube and Reverbnation with this feature. With that being said I also find Facebook's separate friends and followers system to be confusing (and FB is just getting more and more cluttered with every update).

Having a simple follower/friend module would be AWESOME!!

Thanks for considering it :)

PS. my son suggested keeping the following button green and if you are friends have the [friends] button be blue. :)


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3

updated by @the-patria-company: 01/31/16 08:27:52AM
CometChat
CometChat
@cometchat
8 years ago
21 posts
Hi Patria

For any CometChat related issues, please feel free to create a support ticket at https://my.cometchat.com/tickets and our team will be happy to assist you further.

If you have already done so, please share the ticket number so I can escalate the issue.

Regards
Robert
PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
Hey Guys,

I just realized that the @cometchat js may not be loading in and that is the reason that it is not working.

How do I do this in my skin include.php:
jrCore_register_module_feature('jrCore', 'javascript', 'jrElastic', 'jrElastic.js');

To make sure the js is loading to run this:
<a href="javascript:void(0)" onclick="javascript:jqcc.cometchat.chatWith({$_f["`$item["_user_id"]`"]});">

Thanks for the help :)


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3
paul
@paul
8 years ago
4,326 posts
The CometChat module should include the equivalent jrCore_register_module_feature() function in its own include.php file so as to load up all needed JS.


--
Paul Asher - JR Developer and System Import Specialist
PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
In order to test this, I am attempting to make the Profile_Name a link which activates this js. like this (but this code is not working):
{if jrProfile_is_profile_owner($_profile_id)}
                <a href="{$jamroom_url}/{$profile_url}"><h1 class="profile_name">{$profile_name}</h1></a>
                {else}
                <a href="javascript:void(0)" onclick="javascript:jqcc.cometchat.chatWith('{$user_name}');"><h1 class="profile_name">{$profile_name}</h1></a>
                {/if}

I am unsure of the proper syntax to use for the chatWith('{$user_name}'); portion.

I am pretty sure cometchat is linking to users not profiles, so what should I use? $user_id?


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3
michael
@michael
8 years ago
7,714 posts
(Feel like I need to respond because its on the jamroom forums, but have never tried to do what your doing, so don't have the answers and couldn't get the answers without doing it then telling you how it was done)
Seams like your trying to do customizations to cometchat. Try firing things from the console of your browser and see what results you get. or alternatively look at their code to see whats happening. Or look in their database tables to see what they join on.

Those could provide clues as to what is the correct key for that function.
PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
HEY :) I GOT IT!!
<a href="javascript:void(0)" onclick="javascript:jqcc.cometchat.chatWith('{$_user_id}');">

I am using this on individual profiles. Any user of @cometchat can use this with any button or link and when clicked the message box pops up perfectly.

Not sure why it did not work in the array @paul, but we must be close.

I am still interested in the "Friends" identifier, so hopefully we can keep this open for that discussion.

Thanks :)


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3
PatriaCo
PatriaCo
@the-patria-company
8 years ago
349 posts
Thanks again @paul for helping to get this started. I am getting into it again, because only the message link was solved. I am looking closer at the button_following.tpl and think a simple {if} statement could do the trick.

{jrCore_lang module="jrFollower" id="6" default="No longer follow this profile?" assign="prompt"}
{jrCore_lang module="jrFollower" id="8" default="You are currently following this profile" assign="title"}
{if "follow back"}
<input type="button" id="unfollow" class="profile_button follow_button friends=(add blue css)" name="follow" value="{$value}" title="{$title}" onclick="if(confirm('{$prompt|addslashes}')) { jrUnFollowProfile('unfollow',{$profile_id}); }">
{else}
<input type="button" id="unfollow" class="profile_button follow_button following" name="follow" value="{$value}" title="{$title}" onclick="if(confirm('{$prompt|addslashes}')) { jrUnFollowProfile('unfollow',{$profile_id}); }">
{/if}

What could we use to query the db and create the condition for the {if}?
Adding a new css style for the "Friends" button will be easy.

Thanks :)


--
The Patria Company - patriaco.com / quality-trades.com / a-t.life - doing Jamroom since v3

Tags