How to add user contact info with custom function
-
I’m not used of making functions in wp so looking for some help
I’ve set up a new wp on an old (outdated site)
The previous site had nice function that created a list with contact persons based on email profiles in the web hotel’s email
I would like to import and reuse this function in the new wp if poossible as a custom fucntion plugin so I don’t need to mess with the pages
The code looked like this:
<div id="contactinfo"> <?php /* First we set how we'll want to sort the user list. You could sort them by: ------------------------ * ID - User ID number. * user_login - User Login name. * user_nicename - User Nice name ( nice version of login name ). * user_email - User Email Address. * user_url - User Website URL. * user_registered - User Registration date. */ $szSort = "user_nicename"; /* Now we build the custom query to get the ID of the users. */ $aUsersID = $wpdb->get_col( $wpdb->prepare( "SELECT $wpdb->users.ID FROM $wpdb->users ORDER BY %s ASC" , $szSort )); /* Once we have the IDs we loop through them with a Foreach statement. */ $aExcludedIDs = (1); // IDs of the excluded users. foreach ( $aUsersID as $iUserID ) : if ( !in_array( $iUserID, $aExcludedIDs ) ) /* We use get_userdata() function with each ID. */ $user = get_userdata( $iUserID ); echo '<ul class="s_member"><li class="s_name">' . ucwords( strtolower( $user->first_name . ' ' . $user->last_name ) ) . '</li>'; echo '<li class="s_roll">' . $user->user_description . '</li>'; echo '<li class="s_tele"> Telefon:'. ' ' . $user->aim . '</li>'; echo '<li class="s_mail"><a>user_email . '">' . $user->user_email . '</a></li></ul>'; endforeach; // end the users loop. ?> </div>
I would like to recreate this function on my new page, but don’t really now where to start so would appreciate all help
The page I need help with: [log in to see the link]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to add user contact info with custom function’ is closed to new replies.