Advertisement
Search the Community
Showing results for tags 'function'.
-
Using following function you can get a specified user's gender specified variables. For example... echo "Your friend updated " . IPSMember::fetchGenderCall( IPSMember::load( 1 ) ) . " status."; Will output... (if target user is male) Or... (if target user is female) In a shell... [*]This function is to be placed on your ipsMember.php (IPB 3.2.x+) or core.php (older than IPB 3.1.x) [*]This function has two parameters as follows... [*]$memberData - array - Array of data preloaded of the target user [*]$uppercase - boolean - In case if you want to use that on first of a sentence it will uppercase the first letter (e.g. "His topic just got a reply") The code... Open adminsourcesbaseipsMember.php and find fetchSeoName() function. Add this function after that. (You can place this function anywhere, but be sure to put it inside ipsMember class and outside any internal function). /** * Fetches Gender Relative Call * * @access public * @param array Member data * @param boolean Uppercase word's first letter? * @return string Gender */static public function fetchGenderCall( $memberData, $uppercase=false ){ $researchMember = $memberData; if ( ! is_array( $researchMember ) OR ! $researchMember['member_id'] ) { $researchMember = $this->memberData; } if( $researchMember['pp_gender'] == 'm' ) { return ( $uppercase ) ? ucwords( 'his' ) : 'his'; } elseif( $researchMember['pp_gender'] == 'f' ) { return ( $uppercase ) ? ucwords( 'her' ) : 'her'; } // Because mostly men browsing community forums, isn't it? elseif( $researchMember['pp_gender'] == 'u' OR !$researchMember['pp_gender'] ) { return ( $uppercase ) ? ucwords( 'his' ) : 'his'; }} How to call that? A few examples with outputs are below... ("1" indicates the user ID of the targeted user) "Your friend updated " . IPSMember::fetchGenderCall( IPSMember::load( 1 ) ) . " status."; IPSMember::fetchGenderCall( IPSMember::load( 1 ), true ) . " status has been commented."; Thanks for using best forum software ever, Invision Power Board! Keep up the great work!
-
There's a Reference Users function to allow users to say who suggested me the forum? It is possible with custom fields or not?