0 Members and 1 Guest are viewing this topic.

*

staan

  • *
  • 34
  • Stan, 29 Yo - France
  • osDate Version: osDateEvo v1.3
[FRIENDS MOD] {$request_friend} modification
« on: March 15, 2019, 01:35:21 PM »
Hello,

I want to show on my Osdate Evo website a little icon if user get a new friend request.

I found {$request_friend} in code, but it always count old request.

So, I just edited this line in index.php :

Quote
      
    $t->assign('request_friend', $osDB->getOne('select count(*) from ! where fuid=?', array( FRIENDS_TABLE, $_SESSION['UserId'] ) ) );

with this :

Quote
    $t->assign('request_friend', $osDB->getOne('select count(*) from ! where fuid=? and status = 0 ', array( FRIENDS_TABLE, $_SESSION['UserId'] ) ) );

Now, request_friend count only request which are in pending.

« Last Edit: March 15, 2019, 08:33:47 PM by Pharg »

*

Pharg

  • *****
  • 3,240
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: [FRIENDS MOD] {$request_friend} modification
« Reply #1 on: March 15, 2019, 08:33:14 PM »
Hi staan,
 
Thanks for the modification.  :)

As for the friend request isn't working, it wasn't broken at all, it has been modified.

I will add this to the main download soon when I can actually find the code to replace.
« Last Edit: March 15, 2019, 09:14:35 PM by Pharg »
Regards,
Pharg ( Phill )

Don't Personal Message me unless it's about a sensitive matter!!

REMEMBER TO ALWAYS BACKUP BEFORE MAKING ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.2 | MySQL: 5.5.35

*

Pharg

  • *****
  • 3,240
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: [FRIENDS MOD] {$request_friend} modification
« Reply #2 on: March 15, 2019, 09:15:32 PM »
Hi Stann,

Which index.php is this code in as I cannot find it??

Is this the Friends Mod or the myfriends plugin?
« Last Edit: March 15, 2019, 09:19:04 PM by Pharg »
Regards,
Pharg ( Phill )

Don't Personal Message me unless it's about a sensitive matter!!

REMEMBER TO ALWAYS BACKUP BEFORE MAKING ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.2 | MySQL: 5.5.35

*

staan

  • *
  • 34
  • Stan, 29 Yo - France
  • osDate Version: osDateEvo v1.3
Re: [FRIENDS MOD] {$request_friend} modification
« Reply #3 on: March 15, 2019, 10:07:36 PM »
Friends mods, but in fact, I think the first line isn't in index.php at all... I wrote this code there is two weeks and forget it ...

So, in a nutshell, I patched my own code  :-X


You can add this line :

Quote
$t->assign('request_friend', $osDB->getOne('select count(*) from ! where fuid=? and status = 0 ', array( FRIENDS_TABLE, $_SESSION['UserId'] ) ) );

into init.php, and call the var with {$request_friend} on all page, I use it for this :



I'm so sorry if I disturbed your team :(

*

Pharg

  • *****
  • 3,240
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: [FRIENDS MOD] {$request_friend} modification
« Reply #4 on: March 15, 2019, 10:26:30 PM »
Thanks Stann,

Do you have the mod for the images and counting if you would like to share it pease?
Regards,
Pharg ( Phill )

Don't Personal Message me unless it's about a sensitive matter!!

REMEMBER TO ALWAYS BACKUP BEFORE MAKING ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.2 | MySQL: 5.5.35

*

staan

  • *
  • 34
  • Stan, 29 Yo - France
  • osDate Version: osDateEvo v1.3
Re: [FRIENDS MOD] {$request_friend} modification
« Reply #5 on: March 15, 2019, 10:37:27 PM »
It's not a mod, I just wrote the html code


this is the PHP code:

INIT.PHP

Quote
if (isset($_SESSION['UserId'])){

      $t->assign('new_messages', $osDB->getOne('select count(*) from ! where owner=? and recipientid = ? and flagread = 0 and folder = ?', array( MAILBOX_TABLE, $_SESSION['UserId'], $_SESSION['UserId'], 'inbox' ) ) );
      $t->assign('request_friend', $osDB->getOne('select count(*) from ! where fuid=? and status = 0 ', array( FRIENDS_TABLE, $_SESSION['UserId'] ) ) );
      if ($viewswinks_since < $_SESSION['regdate']) $viewswinks_since=$_SESSION['regdate'];
      $sql = 'select count(*) from ! where userid = ? and act_time >= ? and act = ?';
      $t->assign('profile_views', $osDB->getOne($sql, array( VIEWS_WINKS_TABLE, $_SESSION['UserId'], $viewswinks_since, 'V' ) ) );
      $t->assign('winks', $osDB->getOne($sql, array( VIEWS_WINKS_TABLE, $_SESSION['UserId'], $viewswinks_since, 'W' ) ) );

}


this is the code for .TPL file :

Quote

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

{literal}
<style>
.navbar .notification {
    position: absolute;
    top: 0px;
    border: 1px solid #FFF;
    right: 10px;
    font-size: 9px;
    background: #f44336;
    color: #FFFFFF;
    min-width: 20px;
    padding: 0px 5px;
    height: 20px;
    border-radius: 10px;
    text-align: center;
    line-height: 19px;
    vertical-align: middle;
    display: block;
}
.navbar {
  border: 0;
  border-radius: 3px;
  margin-bottom: 0;
  border-bottom: 1px solid #ededf3;
  padding: 10px 0;
}
.navbar .navbar-nav > li > a {
  color: inherit;
  padding-top: 15px;
  padding-bottom: 15px;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  border-radius: 3px;
}
</style>
{/literal}

<ul class="nav navbar-nav">
                <li>
                    <a href="mailmessages.php?messages=inbox" class="dropdown-toggle" title="My messages">
                        <i class="material-icons">email</i>
                  {if $new_messages > 0}<span class="notification">{$new_messages}</span>{/if}
                        <p class="hidden-lg hidden-md">Messages</p>
                    </a>
                </li>
            <li>
                    <a href="listviewswinks.php?act=W" class="dropdown-toggle" title="My Winks">
                        <i class="material-icons">favorite</i>
                  {if $winks > 0}<span class="notification">{$winks}</span>{/if}
                        <p class="hidden-lg hidden-md">My Winks</p>
                    </a>
                </li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" title="Friend Request">
                        <i class="material-icons">group</i>
                        {if $request_friend > 0}<span class="notification">{$request_friend}</span>{/if}
                        <p class="hidden-lg hidden-md">Friends request</p>
                    </a>
                </li>
                <li>
                    <a href="listviewswinks.php?act=V" class="dropdown-toggle" title="My viewers">
                       <i class="material-icons">visibility</i>
                  {if $profile_views > 0}<span class="notification">{$profile_views}</span>{/if}
                       <p class="hidden-lg hidden-md">My viewers</p>
                    </a>
                </li>
            </ul>


Icon set : http://google.github.io/material-design-icons/



*

Pharg

  • *****
  • 3,240
    • OsDateFourm
  • osDate Version: osDateEvo v1.3
Re: [FRIENDS MOD] {$request_friend} modification
« Reply #6 on: March 15, 2019, 11:04:57 PM »
Hi Stann,

Thanks for the share.  ;)
Regards,
Pharg ( Phill )

Don't Personal Message me unless it's about a sensitive matter!!

REMEMBER TO ALWAYS BACKUP BEFORE MAKING ANY CHANGES!!

osDateEvo v1.3 | PHP: 5.3.42 & PHP: 7.2 | MySQL: 5.5.35