-
Author
-
September 3, 2013 at 16:30 #2176joninhasParticipant
How can i put an icon or “member online” to onlnie members?
September 4, 2013 at 20:47 #2251SQadminKeymasterHi,
I don’t know if I understood correctly but to change the default icon for the online members edit your Home page and change your existing shortcode to have an image attribute like this:[kleo_status_icon type=”members_online” image=”http://seventhqueen.com/demo/sweetdatewp/wp-content/uploads/2013/06/apple-touch-icon.png” subtitle=”Members online”]
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionSeptember 4, 2013 at 23:00 #2272joninhasParticipantThe ideia is to put like a greeen bullet on member profile ( if he is online
September 5, 2013 at 13:41 #2301SQadminKeymasterHi,
I can help you with this functions that check if a user is online or not. You need to add them to your sweetdate-child/functions.phpCOPY CODEfunction kleo_is_user_online($user_id, $time=5) { global $wpdb; $sql = $wpdb->prepare( " SELECT u.user_login FROM $wpdb->users u JOIN $wpdb->usermeta um ON um.user_id = u.ID WHERE u.ID = %d AND um.meta_key = 'last_activity' AND DATE_ADD( um.meta_value, INTERVAL %d MINUTE ) >= UTC_TIMESTAMP()", $user_id, $time); $user_login = $wpdb->get_var( $sql ); if(isset($user_login) && $user_login !=""){ return true; } else {return false;} }
To show the status in member directory you have 2 options:
1. edit members/members-loop.php and add this by hand where you want to appear inside the members loop:
<?php if (kleo_is_user_online(bp_get_member_user_id())) { echo "Online"; } else { echo "Offline"; } ?>
2. Add this code to sweetdate-child/functions.php to show it before the members name:
COPY CODEadd_action('bp_members_meta', 'kleo_online_status'); function kleo_online_status() { if (kleo_is_user_online(bp_get_member_user_id())) { echo "Online"; } else { echo "Offline"; } }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 16, 2013 at 02:12 #4475Nick34000ParticipantHello! Thank you for your wonderful theme! I would do the same thing joninhas but I can not find file members / members-loop.php in my child theme. Where is it on? thank you
October 16, 2013 at 21:21 #4503cajoejoeParticipantCopy it from sweetdate/members/members-loop.php
to
sweetdate-child/members/members-loop.phpThat’s where i see a file by that name…
October 16, 2013 at 22:07 #4505willianlima83ParticipantHi
I tryed to put the ”online symbol” on my site but it not works.. What I did wrong?
1 – Need I put the code on sweet-child/Members/single/articles/loop.php
Or
sweetdate/members / members-loop.php???
2 – Need I put the code inside the <?php …code… ?> ???October 16, 2013 at 23:21 #4509cajoejoeParticipantI am having the same issue. I created a members-loop.php and inserting the code i get an error. When i i add the code to the articles/loop.php, the code doesnt work.
example of error for scenario 1
Parse error: syntax error, unexpected ‘<‘ in /home/content/79/11835379/html/arm/wp-content/themes/sweetdate-child/members/members-loop.php on line 2
October 16, 2013 at 23:53 #4518SQadminKeymasterHi,
The editor modified the code and probably generating an error.File is: Copy it from sweetdate/members/members-loop.php
Copy it from sweetdate/members/members-loop.php
to
sweetdate-child/members/members-loop.phpHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 18, 2013 at 03:03 #4577willianlima83ParticipantSorry.. I’m lost still…
I edited the file and copy to sweetdate-child/members/members-loop.phpDoes not work… đ
October 18, 2013 at 14:14 #4601SQadminKeymasterYou copy the file to sweetdate-child/members/members-loop.php and edit it there.
You must have the child theme activated. To see if the changes take effect add some text somethere and see if it appears. If the text appears then you are not doing the edit rightHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 20, 2013 at 23:20 #4746willianlima83ParticipantMy theme that is active is:
Tema actual
Sweetdate Child
Por SeventhQueenVersĂŁo 2.0I did copy the file to sweetdate-child/members/members-loop.php and edit there..
I cant see the ”online signal” on profile..
I’m did many tests with 2 different browsers with 2 member online.. and with 2 computers online in differents houses… Not works.. đNow I have just a question: My theme was updated automatically some days ago, why the version that appear is 2.0 and not 2.2 (that was my last updated version I think)??????????????????
PS. When the updated was completed the new version was actived, I remember that…October 21, 2013 at 10:31 #4749AnchoraParticipantyou’re sure that you also put the code in functions.php?
October 22, 2013 at 00:49 #4844SQadminKeymasterHave you tried my suggestion with adding some random text to the template and see if it displays to make sure you are editing the right one or the file is in place?
Probably you Sweetdate Child shows 2.0 which is good because the child theme doesn’t get updated
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 22, 2013 at 05:02 #4863willianlima83ParticipantYes.. I edited a file and the text appears on my site…
October 22, 2013 at 21:37 #4901SQadminKeymasterSo after you add those functions to sweetdate-child/functions.php add the code to members/members-loop.php
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 23, 2013 at 01:24 #4933SQadminKeymaster… you need to add it in the loop, somewhere around
<div class=âavatarâ>
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 23, 2013 at 01:45 #4937willianlima83ParticipantOk, thanks..
Now the site is not blocked with the new code but not appear the ”signal online” on profile..October 25, 2013 at 01:00 #5084Nick34000ParticipantI added the code to my file, but I can see it only displays offline even I am connected.
I also tried to add in the membership directory, then it works but members offline fade instead of marking offline.
October 25, 2013 at 15:36 #5115gideon1210ParticipantWhen i add this code it works apart from under all members search it only show online not both
October 25, 2013 at 16:28 #5117willianlima83ParticipantYes.. on my site this code not works too.. I don’t know what is the problem..
October 26, 2013 at 03:30 #5149SQadminKeymasterHey guys,
I modified the above code so now it is only one functions and accepts as a parameter the user id. To show the status in member directory you have 2 options:1. edit members/members-loop.php and add this by hand where you want to appear inside the members loop:
<?php if (kleo_is_user_online(bp_get_member_user_id())) { echo "Online"; } else { echo "Offline"; } ?>
2. Add this code to sweetdate-child/functions.php to show it before the name:
COPY CODEadd_action('bp_members_meta', 'kleo_online_status'); function kleo_online_status() { if (kleo_is_user_online(bp_get_member_user_id())) { echo "Online"; } else { echo "Offline"; } }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 26, 2013 at 15:29 #5171Nick34000ParticipantIt’s still not working ! when i add le code in my functions file, members who are connected are show but the offline one’s just doesnât show !
October 26, 2013 at 18:54 #5179SQadminKeymasterThe full code is uphere: https://archived.seventhqueen.com/forums/topic/check-if-user-is-online#reply-2301
Works 100%
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 29, 2013 at 10:41 #5315SQadminKeymasterYour code is old. Put the new code that is in my above post
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 29, 2013 at 17:34 #5357willianlima83ParticipantHi
The code to add the word ”online” and ”offline” after the name on member directory is working very well…
The other code to add on the members loop by hand, I can’t…
My code on members-loop.php is like that:
(what is wrong?)<?php
/**
* BuddyPress – Members Loop
*
* Querystring is set via AJAX in _inc/ajax.php – bp_dtheme_object_filter()
*
* @package BuddyPress
* @subpackage bp-default
*/?>
<?php if (kleo_is_user_online(bp_get_member_user_id())) { echo “Online”; } else { echo “Offline”; } ?><?php do_action( ‘bp_before_members_loop’ ); ?>
<?php if ( bp_has_members( bp_ajax_querystring( ‘members’ ). ‘&per_page=’.sq_option(‘buddypress_perpage’) ) ) : ?>
<?php do_action( ‘bp_before_directory_members_list’ ); ?>
<div class=”item-list search-list” id=”members-list”>
<?php while ( bp_members() ) : bp_the_member(); ?><div class=”four columns”>
<div class=”search-item”>
<div class=”avatar”>
<?php bp_member_avatar(‘type=full&width=94&height=94&class=’); ?>
</div>
<?php do_action(‘bp_members_meta’);?>
<div class=”search-body”>
<?php do_action( ‘bp_directory_members_item’ ); ?>
</div>
<div class=”bp-member-dir-buttons”>
<?php do_action(‘bp_directory_members_item_last’);?>
</div>
</div>
</div><?php endwhile; ?>
</div><?php do_action( ‘bp_after_directory_members_list’ ); ?>
<?php bp_member_hidden_fields(); ?>
<!– Pagination –>
<div class=”row”>
<div class=”twelve columns pagination-centered”>
<div class=”pagination” id=”pag-bottom”>
<div id=”member-dir-pag-bottom” class=”pagination-links”>
<?php bp_members_pagination_links(); ?>
</div>
</div>
</div>
</div>
<!–end Pagination–>
<?php else: ?><div id=”message” class=”alert-box”>
<?php _e( “Sorry, no members were found.”, ‘kleo_framework’); ?>
</div><?php endif; ?>
<?php do_action( ‘bp_after_members_loop’ ); ?>
<div class=âavatarâ>
October 30, 2013 at 17:14 #5406SQadminKeymasterHi,
Please wait for next theme update in about 1-2 weeks and will include this by default.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionOctober 30, 2013 at 18:17 #5410willianlima83ParticipantOk.. thank you.. I think this function is very good if included by default…
October 31, 2013 at 19:15 #5491cajoejoeParticipantsqadmin,
That will be awesome and less headache… How about listing of all subscribers pictures of course based on gender (females/males -not mixed) pages listed when user of a gender logs in?
November 1, 2013 at 11:21 #5531SQadminKeymasterThat is more of a customized functionality and doesn’t apply to all
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.