This topic has 35 replies, 7 voices, and was last updated 10 years by SQadmin.

  • Author
  • #2176
     joninhas
    Participant

    How can i put an icon or “member online” to onlnie members?

    #2251
     SQadmin
    Keymaster

    Hi,
    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 solution
    #2272
     joninhas
    Participant

    The ideia is to put like a greeen bullet on member profile ( if he is online

    #2301
     SQadmin
    Keymaster

    Hi,
    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.php

    COPY CODE
    
    function 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 CODE
    
    add_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 solution
    #4475
     Nick34000
    Participant

    Hello! 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

    #4503
     cajoejoe
    Participant

    Copy it from sweetdate/members/members-loop.php
    to
    sweetdate-child/members/members-loop.php

    That’s where i see a file by that name…

    #4505
     willianlima83
    Participant

    Hi
    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… ?> ???

    #4509
     cajoejoe
    Participant

    I 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

    #4518
     SQadmin
    Keymaster

    Hi,
    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.php

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #4577
     willianlima83
    Participant

    Sorry.. I’m lost still…
    I edited the file and copy to sweetdate-child/members/members-loop.php

    Does not work… 🙁

    #4601
     SQadmin
    Keymaster

    You 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 right

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #4746
     willianlima83
    Participant

    My theme that is active is:
    Tema actual
    Sweetdate Child
    Por SeventhQueenVersĂŁo 2.0

    I 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…

    #4749
     Anchora
    Participant

    you’re sure that you also put the code in functions.php?

    #4758
     willianlima83
    Participant

    Yes.. Im sure…

    #4844
     SQadmin
    Keymaster

    Have 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 solution
    #4863
     willianlima83
    Participant

    Yes.. I edited a file and the text appears on my site…

    #4901
     SQadmin
    Keymaster

    So 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 solution
    #4906
     willianlima83
    Participant
    This reply has been set as private.
    #4933
     SQadmin
    Keymaster

    … 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 solution
    #4937
     willianlima83
    Participant

    Ok, thanks..
    Now the site is not blocked with the new code but not appear the ”signal online” on profile..

    #4938
     willianlima83
    Participant
    This reply has been set as private.
    #4958
     willianlima83
    Participant
    This reply has been set as private.
    #5084
     Nick34000
    Participant

    I 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.

    #5115
     gideon1210
    Participant

    When i add this code it works apart from under all members search it only show online not both

    #5117
     willianlima83
    Participant

    Yes.. on my site this code not works too.. I don’t know what is the problem..

    #5149
     SQadmin
    Keymaster

    Hey 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 CODE
    
    add_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 solution
    #5171
     Nick34000
    Participant

    It’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 !

    #5179
     SQadmin
    Keymaster

    The 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 solution
    #5284
     willianlima83
    Participant
    This reply has been set as private.
    #5315
     SQadmin
    Keymaster

    Your 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 solution
    #5357
     willianlima83
    Participant

    Hi

    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”>

    #5358
     willianlima83
    Participant
    This reply has been set as private.
    #5406
     SQadmin
    Keymaster

    Hi,
    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 solution
    #5410
     willianlima83
    Participant

    Ok.. thank you.. I think this function is very good if included by default…

    #5491
     cajoejoe
    Participant

    sqadmin,

    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?

    #5531
     SQadmin
    Keymaster

    That 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
Viewing 36 posts - 1 through 36 (of 36 total)

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?