Message with friends request.

I have looked through the market and found nothing.  It would be nice if one could send a message along with the friends request; such as, "Hello, I see we share an interest in fine wines.  Would you consider adding me to your friends list?"  We had this feature on a now defunct website and it does help.  The message would be deleted from the database once the friends request is accepted or denied.

Geeks, making the world a better place
Quote · 11 Oct 2013

would it be feasable to create another button for friend request and have it open a popup in which would have a textarea for the person to write a message. I know i have a similar deal and was wondering if it would be reworkable for you.

caredesign.net
Quote · 11 Oct 2013

Yes, rework of the friend request; click on the button, the pop-up then requests the message, submit button, "Send Friend's request" "Cancel" and it stores the message in the database along with the friend request.  Now on the account side of things, our list of friends request needs a link; "See Message" that when click will pop-up the message.

Geeks, making the world a better place
Quote · 11 Oct 2013

I have been thinking about this as well.

There is a mod that puts friends requests in a block on the user's profile.

I moved it to the home page, there could be a link that says "Show Message" and pops up the message.

Hmmm........

http://www.mytikibar.com
Quote · 11 Oct 2013

Looking at this, I think requests are handled by the sys_friends_list based on the Check field.  When someone requests to be friends, it is added to the sys_friends_list and the Check field is set to zero.  When the friends request is accepted, the Check field is set to 1.  Is this correct?  I am assuming that if the request is denied, then it is removed from the table.  If this is the case, then adding a field to the table to store the message should work.  It can be written at the same time the friend is added to the table with Check set to zero.  The message can be left in the table or updated to null when the Check is set to 1.  If I am understanding how friends requests work.

Note: I am quite happy with the friend's request block in the account page.

Geeks, making the world a better place
Quote · 11 Oct 2013

yes GG - when a request is sent it is added and the field is set to 0 - then when the request is accepted it is set to 1. But just a curious question - is deleting the message absolutely needed. reason I ask - one day you decide to streamline your friends, and wonder why you accepted someones friend request to begin with - keeping the message would allow you to see why you did so.

caredesign.net
Quote · 12 Oct 2013

 

yes GG - when a request is sent it is added and the field is set to 0 - then when the request is accepted it is set to 1. But just a curious question - is deleting the message absolutely needed. reason I ask - one day you decide to streamline your friends, and wonder why you accepted someones friend request to begin with - keeping the message would allow you to see why you did so.

Once you accept a friend request, you no longer have that in the account block.  However, I guess one could write a script to fetch them.  On the defunct social site; once you accepted the friend request, you could no longer access the message.  However, the only reason for deleting it would be to save a bit of space in the database file; although the size of the database does not grow that much; most of the space is taken up from photos and videos and sounds and files stored on the server.

OK, so what do we do to present a message block to the member when they decide to befriend someone?  We will do a query to add a field to the sys_friends_list table to hold the message.  We need to present a simple text form; no TinyMCE editor, just simple text, and then store that in our new field.  We need to edit the account block to include a link to view the message in a pop-up.

Geeks, making the world a better place
Quote · 12 Oct 2013

i will put something together tonight and hope it is what you are looking for - but the idea of it is a great one.

caredesign.net
Quote · 12 Oct 2013

 

i will put something together tonight and hope it is what you are looking for - but the idea of it is a great one.

Thanks for the effort, I have yet to look into any of it, just formulating the idea and the process flow.

Geeks, making the world a better place
Quote · 12 Oct 2013

i got most of it done - just working on the last bit of the message part - but just to run this by you real quick:

When you get a friend request and you see it in the blosck, there is a line that says Mutual Frineds. My thought is to add another line underneath it that has the message - that way when you accept it, you dont see the message anymore as the request is removed from the block - see image attached.

friend request.png · 90.4K · 500 views
caredesign.net
Quote · 12 Oct 2013

OK, I am not sure if this is 100% correct, but it seems to be working for me - here is what I did:

BxBaseCommunicator.php around line 300:

$aProcessedRows[] = array (
                        'js_object'      => $sJsObject,

                        'row_value' => $aItems['member_id'],
                        'member_icon' => $sMemberIcon,
                        'member_nick_name' => $sMemberNickName,

                        // define the profile page location ;
                        'member_location' => $sMemberLocation ? '<a href="' . $sMemberLocation . '">' . $sMemberNickName . '</a>' : '',

                        // define the member's sex ;
                        'member_sex_img' => $sMemberSexImg ? ' <img src="' . $sMemberSexImg . '" alt="' . $aProfileInfo['Sex'] . '" />' : '',

                        'member_age' => $sMemberAge,
                        'member_flag' => $sMemberCountryFlag,
                        'member_country' => $sMemberCountry,
                       
                        'friend_request_message' => getFriendRequestMessage($aItems['member_id'], getLoggedId()),
 
                        'member_mutual_friends' => _t('_sys_cnts_txt_mutual_friends', ($iMemberMutualFriends > 0 ? $iMemberMutualFriends : _t('_sys_cnts_txt_mf_no'))),

                        'type' => $aItems['type'],
                        'message_date' => $aItems['date'],
                    );

                    $iIndex++;
                }

added section in red

profiles.inc.php added the following function:

function getFriendRequestMessage($iId, $iProfileId)
{
     $iId = (int)$iId;
    $iProfileId = (int)$iProfileId;
    $FRmessages = mysql_query("SELECT * FROM sys_friend_list WHERE `Profile` = {$iProfileId} AND `ID` = {$iId}");
// We are going to use the "$row" method for this query. This is just my preference.
while ($row_FRmessages = mysql_fetch_array($FRmessages)) {
    $FriendRequestMessage = $row_FRmessages["message"];
}
return $FriendRequestMessage;
}

 

communicator_page_fr.html around line 8:

<div class="sys-cntsfr-author-info">__member_location__</div>
                <div class="bx-def-font-small bx-def-font-grayed">__member_mutual_friends__</div>
                <div class="bx-def-font-small bx-def-font-grayed">__friend_request_message__</div>

added section in red

 

Created a page callef befriend.php in main directory - attaching below.

Added a button to sys_objects_actions table in database using the following sql query:

INSERT INTO `sys_objects_actions` (`ID`, `Caption`, `Icon`, `Url`, `Script`, `Eval`, `Order`, `Type`, `bDisplayInSubMenuHeader`) VALUES (NULL, '{evalResult}', 'plus', '', 'showPopupAnyHtml(''befriend.php?member={ID}'')', 'if ({ID} == {member_id}) return;
return _t(''{cpt_befriend}'');', '1', 'Profile', '0');

 

Then deleted the original button from sys_objects_actions table in database

 

So - now, when clicking the Befriend button a popup appears in which you can enter the reason for your friend request. And the person you sent the request to can see the message with the friend request itself. I hope this is at least close to what you are looking for GG. Again, it may not be written 100% correctly, but if not I hope it gives an idea how to accomplish what you want.

friend request final.png · 86.4K · 551 views
befriend.php · 3.9K · 501 downloads
caredesign.net
Quote · 12 Oct 2013

oh shoot - i forgot one thing - added a field called "message" to the sys_friend_list table in the database. Also - I am attaching a new befriend.php. Forgot to add the piece so that if you already have a pending friend request.

befriend.php · 4.5K · 503 downloads
caredesign.net
Quote · 12 Oct 2013

The thing I don't like about this is it should just fill in the popup with your friend request is sent and allow you to close the box.

It kinda takes you to nowhere land to display the "friend request is sent" box.

I'd like it to stay in the pop up box.

http://www.mytikibar.com
Quote · 12 Oct 2013

After my luck, I am completely afraid to touch the tables. I am even afraid to update mods and update boonex. But I would love to try this out.

Quote · 12 Oct 2013

 

The thing I don't like about this is it should just fill in the popup with your friend request is sent and allow you to close the box.

It kinda takes you to nowhere land to display the "friend request is sent" box.

I'd like it to stay in the pop up box.

I am not sure I follow you here.

Geeks, making the world a better place
Quote · 12 Oct 2013

Let me try this out on the test site.  Thanks for your work and I will report back with any issues.

Geeks, making the world a better place
Quote · 12 Oct 2013

this was something that I thought is a great idea, and could be used by many so I wanted to help out as much as I could. As I said before, the coding may not be 100% correct, but I hope it at least sparks one of the gurus to take a look and give a better/more stable solution. I know in the past persons such as deano have come behind and written a solution that is way shorter and easier than what I have posted, and hoping someone does so again. It was an interesting task and I wanted to see if I could come up with a solution at all. So now I am anticipating GGs testing to see how it works for her.

caredesign.net
Quote · 12 Oct 2013

Just finished installing and testing and it does work.  On the pop-up form for the message there was an input field with 1.  What is that field; was it suppose to be an hidden input field?

On the account page my request block is in a narrow column and I am seeing some display problems; I will play with the template to see why, I am seeing overlapping from one request to the next and that template does have the float clearing division so I don't know why it should be that way.

On the pop-up "Friends Request Sent" I wonder if we can do the auto close after a time like some of the Dolphin Pop-ups do; like in the builders in the admin; not important of course.

Also, I was seeing a narrow message box; will look at the code for that as well.  Overall, very nice job, thanks.

Oh, on the defunct social site, sometimes the messages could get a bit long to be displayed directly unless on a bigger box; I want to keep it in the narrow column so I am going to look at either an excerpt of the message with a <more> link that will then pop-up the full message, or just a <read message> link and the whole message pops up to be read.

 

Thanks a bunch for getting this started; I don't know why Boonex did not included it; oh yes, that is correct, they have never been on a social site before LOL.

Geeks, making the world a better place
Quote · 12 Oct 2013

oh - i had that so i could make sure it was going to the correct member ID - forgot to hide that when i was done

caredesign.net
Quote · 12 Oct 2013

 

oh - i had that so i could make sure it was going to the correct member ID - forgot to hide that when i was done

I figured that was suppose to be a hidden field.

Geeks, making the world a better place
Quote · 12 Oct 2013

The other missing piece to Friends Request that Boonex did not include is that you can not rescind a request.  I should have a block in my profile; and in the connections page, that shows a list of pending friends request that I have sent that have yet to be accepted.  I should be able to delete a friends request, to rescind the request by removing it.

Geeks, making the world a better place
Quote · 12 Oct 2013

When I do the friend request, it does not stay within the pop up, it's staying in yours?

http://www.mytikibar.com
Quote · 12 Oct 2013

post a screenshot please

caredesign.net
Quote · 12 Oct 2013

 

The other missing piece to Friends Request that Boonex did not include is that you can not rescind a request.  I should have a block in my profile; and in the connections page, that shows a list of pending friends request that I have sent that have yet to be accepted.  I should be able to delete a friends request, to rescind the request by removing it.

 I cannot figure out the new PHPMyadmin but....

(183, '{cpt_declinefriend}', 'action_block.png', '', '{evalResult}', 'if ({ID} == {member_id} OR !is_friendRequest({ID} , {member_id}) ) return;\nreturn "$.post(''list_pop.php?action=remove_friend'', { ID: ''{ID}'' }, function(sData){ $(''#ajaxy_popup_result_div_{ID}'').html(sData) } );\n$(''#short_profile_info'').fadeOut(5000, function(){location.reload()});\nreturn false;";', 33, 'Profile', 0),

 

 

This is out of my database, this declines a friendship

http://www.mytikibar.com
Quote · 12 Oct 2013

 

post a screenshot please

 here ya go!

What does yours look like?

shot1.png · 95.8K · 507 views
shot2.png · 44K · 488 views
http://www.mytikibar.com
Quote · 12 Oct 2013

i would have to say that is something with your custom template as there is no X in the upper right corner to close the box. I did it using the default template so don't know how it would affect custom templates.

befriend 1.png · 21.4K · 521 views
befriend 2.png · 13.5K · 516 views
befriend 3.png · 501.3K · 523 views
caredesign.net
Quote · 12 Oct 2013

@Steve - I just noticed what may be happening - for some reason, on your friend request - after the friend request is submitted, it looks to be redirecting to yoursite.com/befriend.php on your main site page, instead of retaining this in the popup itself. At no point should the page behind the popup change, and it looks like that is what is going on in your case.

caredesign.net
Quote · 12 Oct 2013

 

 

The other missing piece to Friends Request that Boonex did not include is that you can not rescind a request.  I should have a block in my profile; and in the connections page, that shows a list of pending friends request that I have sent that have yet to be accepted.  I should be able to delete a friends request, to rescind the request by removing it.

 I cannot figure out the new PHPMyadmin but....

(183, '{cpt_declinefriend}', 'action_block.png', '', '{evalResult}', 'if ({ID} == {member_id} OR !is_friendRequest({ID} , {member_id}) ) return;\nreturn "$.post(''list_pop.php?action=remove_friend'', { ID: ''{ID}'' }, function(sData){ $(''#ajaxy_popup_result_div_{ID}'').html(sData) } );\n$(''#short_profile_info'').fadeOut(5000, function(){location.reload()});\nreturn false;";', 33, 'Profile', 0),

 

 

This is out of my database, this declines a friendship

 

If I am understanding GG correctly, I think she is looking for this:

I am looking at my account or my profile page for example, on this page, I can see all friend requests that I have sent out that have yet to be accepted. In this list, I have the option to cancel a pending friend request that I have sent out.

If that is the case, thats an easy one - unless you are thinking of retaining the original look of the incoming frined requests showing the user pic and all - but shouldnt be too hard as the functions are already there.

caredesign.net
Quote · 12 Oct 2013

 

 

If I am understanding GG correctly, I think she is looking for this:

I am looking at my account or my profile page for example, on this page, I can see all friend requests that I have sent out that have yet to be accepted. In this list, I have the option to cancel a pending friend request that I have sent out.

If that is the case, thats an easy one - unless you are thinking of retaining the original look of the incoming frined requests showing the user pic and all - but shouldnt be too hard as the functions are already there.

Yes, a new block that shows "Friend Requests I Have Sent" or something along that.

In the block will be each friend request I have sent that is still pending.  There will be a button to "Rescind Request" and I can then remove the request.  Sometimes one may send a request and if after a few days it has not been answer then remove it.  I saw that as well at the defunct social network.  One may change their mind after seeing some content or reply or just change their minds as we are apt to do :-).

Geeks, making the world a better place
Quote · 12 Oct 2013

 

i would have to say that is something with your custom template as there is no X in the upper right corner to close the box. I did it using the default template so don't know how it would affect custom templates.

Is there an easy way to close the box after a period of time instead of using the x?

Geeks, making the world a better place
Quote · 12 Oct 2013

in communicator_page.css find:

div.sys-connections-fr {
    position: relative;
    height: 64px;
}

Need to remove that fixed height.

Geeks, making the world a better place
Quote · 12 Oct 2013

 Is there an easy way to close the box after a period of time instead of using the x?

 

I see there are already functions to close a popup, but how to add to what i did, I have no clue. Besides that, here is a bigger issue with that. If setting to close after a certain period of time may nopt exactly work. Reason: if we set it at say 5 seconds, then the user has 5 seconds to fill in the form for the friend request or the page will close on them. Now - that is using the current coding of the form.

If the form is written to standard php coding, instead of suing Dolphins form template, then this could be achieved by A. first page of the popup is the form itself which then sends the info using POST to a second page that handles the actual sql query and stuff, then B. after submission we could add a timer to close the window.

For now, that is the easiest solution that I can think of but would require redoing the frined request popup.

caredesign.net
Quote · 13 Oct 2013

 

@Steve - I just noticed what may be happening - for some reason, on your friend request - after the friend request is submitted, it looks to be redirecting to yoursite.com/befriend.php on your main site page, instead of retaining this in the popup itself. At no point should the page behind the popup change, and it looks like that is what is going on in your case.

 

When I do this to the code, I get the "Friend request sent" message in a popup.

 // generate form or form result content
$oForm = new BxTemplFormView($aForm);
$oForm->initChecker();
//if ($oForm->isSubmittedAndValid()) {
    $s = BefriendMember($iSenderID) ? "Friend Request Sent" : "Friend Request Sent";
    $sPageCode = MsgBox(_t($s));

//} else {
//    $sPageCode = $oForm->getCode();
//}

It's only when the form returns from submission.

I have NO idea where to even begin to look why this happens.

Any ideas?

http://www.mytikibar.com
Quote · 13 Oct 2013

the only thing I can think of is maybe something to do with having a custom template - did you happen to try the original form using the Uni template and seeing if anything weird happens. Not knowing what changes you have made to your site leaves the question open to hundreds of possible reasons, and I too wouldn't know where to start other than changing back to default templates. When I put that together, I used an installation of Dolphin that has had no edits to it whatsoever. I wish I could be more help on this part.

caredesign.net
Quote · 13 Oct 2013

@Steve - another thing: I created the form using the original tellfriend.php page, and thus should function the same. What happens if using your Invite A Friend link

caredesign.net
Quote · 13 Oct 2013

 

 Is there an easy way to close the box after a period of time instead of using the x?

 

I see there are already functions to close a popup, but how to add to what i did, I have no clue. Besides that, here is a bigger issue with that. If setting to close after a certain period of time may nopt exactly work. Reason: if we set it at say 5 seconds, then the user has 5 seconds to fill in the form for the friend request or the page will close on them. Now - that is using the current coding of the form.

If the form is written to standard php coding, instead of suing Dolphins form template, then this could be achieved by A. first page of the popup is the form itself which then sends the info using POST to a second page that handles the actual sql query and stuff, then B. after submission we could add a timer to close the window.

For now, that is the easiest solution that I can think of but would require redoing the frined request popup.

Forget that, the red x is just fine.  We will figure out why Steve does not have the x

Geeks, making the world a better place
Quote · 13 Oct 2013

OK, the reason the textarea box is so narrow is because it is floated left:

<div class="input_wrapper input_wrapper_textarea bx-def-round-corners-with-border">

The class is the input_wrapper.  Remove the floated left (use FireBug to see) and the textarea box is full width.

So, we can not change the CSS, we need to change the template but I don't know where.  I see this a lot with Dolphin where I can not find where to change.  The two templates mentioned don't have that division.  If we change the CSS, it will affect all others and we don't want that.  We just need to create our own template for this.


Also, look at the old befriend button.  If one is already a friend it would change to "- unbefriend".  Can we do that as well?


Geeks, making the world a better place
Quote · 13 Oct 2013

the templates for that pop are popup.html and default_margin.html - what i have done on other popups is copy the popup.html (as it is used for other popups already included in dolphin) and change the reference for popup.html in the befriend.php page to the name of the new html page.

The unbefriend should already be in place as it looks in the database to see if the person is a friend, will have to check that part out.

 

EDIT: I am going to have to create a new function and rework the befriend.php page. Apparently the function that handles this is part of the whole friend function and is checked within that function. Seems basically like an if/else - if a friend already display the unfriend, else display the befriend.

caredesign.net
Quote · 13 Oct 2013

I had a brain fart there and just realized something - there is no need to change the template of the befriend.php page, just add:

'colspan' => '2',

to the textarea field. This will expand it all the way across.

caredesign.net
Quote · 13 Oct 2013

 

@Steve - another thing: I created the form using the original tellfriend.php page, and thus should function the same. What happens if using your Invite A Friend link

So to throw another wrench in the mix.  When I go to my bone stock D7.0.9 site and add this mod, it does the same thing!

But, the share button (which uses tellfriend.php works fine)...

So I am not going crazy, and now that I know you modded the tellfriend.php, that gives me a direction to look. 

http://www.mytikibar.com
Quote · 13 Oct 2013

Just to let you know, I got it working with D 7.0.9!!

There is no function bx_ajax_form_check in D 7.0.9.

I simply copied the function into /inc/js/functions.js from D 7.1.4

 

http://www.mytikibar.com
Quote · 13 Oct 2013

 

I had a brain fart there and just realized something - there is no need to change the template of the befriend.php page, just add:

'colspan' => '2',

to the textarea field. This will expand it all the way across.

No, the colspan is already there.  I use firebug to check the code and found out it is the float that is causing it to be narrow.  However, another solution that I have used before is to simply overwrite the css locally in the code.  I will give that a try and report back.  I did a search for input_wrapper but could not find it in the template.  I was going to create a new pop-html template but that template does not have input_wrapper.  Dolphin is so convoluted at times.

Geeks, making the world a better place
Quote · 13 Oct 2013

Here is the solution to the narrow textarea box.  The reason it is narrow is not column span, which is set to 2.  The reason is that the textarea is floated left by the CSS.  Now, we do not want to edit the CSS sheet because that could screw up the layout of our other forms; since it is shared with other forms.

The item in question is input_wrapper.  That class is added when the form is generated by BxBaseFormView.php.  Now that class may be in other templates, so you have to check to see if they contain it as well.  The form generator adds a division around the textarea and adds class="input_wrapper:

        $sCode = <<<BLAH
                        <div class="input_wrapper input_wrapper_{$aInput['type']} $sClassAdd" $sAttr>
                            $sContent
                        </div>
BLAH;

What we want to do is to add a class so we can override the float in input_wrapper;

        $sCode = <<<BLAH
                        <div class="input_wrapper input_wrapper_override input_wrapper_{$aInput['type']} $sClassAdd" $sAttr>
                            $sContent
                        </div>
BLAH;

If this class is not present, then it will have no affect.  We only want it to apply when we use our custom pop-up form.  So, we don't add this class to the style sheets, we will add it to a custom template.  We will copy popup.html to popup2.html.  At the top of the template we will add our override class.

<style>.input_wrapper_override {float:none;}</style>
<div class="disignBoxFirst bx-def-border">
    <div class="boxFirstHeader bx-def-bh-margin">__title__<div class="dbTopMenu"><i class="login_ajx_close sys-icon remove"></i></div></div>
    <div class="boxContent">
        __content__      
    </div>
</div>

Now we can remove the float without affecting any other form on our site.

in our befriend.php, we change to point to our custom template:

// output ajax popup
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
    $aVarsPopup = array (
        'title' => $_page['header'],
        'content' => $sPageCode,
    );
    header('Content-type:text/html;charset=utf-8');
    echo $GLOBALS['oFunctions']->transBox($GLOBALS['oSysTemplate']->parseHtmlByName('popup2.html', $aVarsPopup), true);
    exit;
}

Now our textarea will fill the space instead of being narrow and to the left.

Geeks, making the world a better place
Quote · 13 Oct 2013

Professor, I don't think we finished up this project.  Would be another module you can add to your list of modules.  I redid my test site and lost this addition so will have to start over.

Geeks, making the world a better place
Quote · 7 Jan 2014


Hello,

 

Another question, does that also apply to Dolphin 7.4.2?

I need this solution for the above mentioned version.

Thanks in advance

Thomas

 

Quote · 20 Jan 2020

In which file i should code this:

 

$sCode = <<<BLAH
                        <div class="input_wrapper input_wrapper_override input_wrapper_{$aInput['type']} $sClassAdd" $sAttr>
                            $sContent
                        </div>
BLAH;

Quote · 20 Jan 2020
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.