Skip to:
Content
Pages
Categories
Search
Top
Bottom

[Resolved] More Info on User Page

  • @niklas_wa

    Participant

    I’d like to display more info on a user-page.

    For this, i need a function to display the current viewed user.

    My current Code:

    <?php
    /*
    Plugin Name: TimoliaUserInfo
    Plugin URI: http://www.timolia.de
    Description: Timolia User Info - Displays Last_Online, First_Online
    Version: 0.1
    */
    
    function bp_plugin_filter_latest_update( $update = '' ) {
    	
     	$db = mysql_connect ( "*******", "*********", "***********" ) or die ( 'I cannot connect to the database  because: ' . mysql_error () );
    
    	$mydb = mysql_select_db ( "*********" );
    
    	
    
    	$sql = 'SELECT first_played, last_played FROM timolia_user WHERE name="' . $bp->displayed_user->fullname . '" LIMIT 1';
    
    // *** HERE IS THE PROBLEM, I NEED TO SELECT ONLY THE CURRENT DISPLAYED USER (IT WORKS WITH wp_get_current_user ()->user_login BUT THAT IS NOT THAT WHAT I WANT) :D ***
    
    	$query = mysql_query ( $sql );
    
    	
    
    	if ($query == FALSE) {
    
    		die ( mysql_error () );
    
    	}
    
    	echo '<table>';
    
    	while ( $fetch = mysql_fetch_array ( $query ) ) {
    
    		echo '  <center>
    				   
    				   <strong>First time played:</strong>
    
    				   <b>' . $fetch ['first_played'] . '</b>
    				   
    				   <br>
    				   <br>
    				   
    				   <strong>Last time played:</strong>
    				   
    				   <b>' . $fetch ['last_played'] . '</b>
    				   
                    </center>								';
    
    	}
    
    	echo '</table>';
    	
    }
     
    add_filter( 'bp_get_activity_latest_update', 'bp_plugin_filter_latest_update', 10, 1 );
    add_filter( 'bp_get_member_latest_update', 'bp_plugin_filter_latest_update', 10, 1 );
    
     
    add_filter( 'bp_get_activity_latest_update', 'bp_plugin_filter_latest_update', 10, 1 );
    ?>

    The problem is commented.

Viewing 2 replies - 1 through 2 (of 2 total)
  • @niklas_wa

    Participant

    I need a function where I do not get the ID (bp_displayed_user_id()) but the Username (Not the fullname)

    @niklas_wa

    Participant

    Okay i have found it *facepalm*

    bp_displayed_user_mentionname()

    You can close it..

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] More Info on User Page’ is closed to new replies.
Skip to toolbar