Results 1 to 10 of 10

Thread: Add an Editable Phone Number to Public Profiles

  1. #1
    Thread Starter
    paulogoode's Avatar
    Join Date
    Oct 2012
    Location
    Ireland
    Posts
    37
    Thanks
    30
    Thanked 8 Times in 6 Posts

    Add an Editable Phone Number to Public Profiles

    I have been reading the forums a lot since I purchased ClassiPress and have used the shared information to improve my sites. So I thought it was about time that I gave a little back to the community to say 'thank you'.

    This mod will allow you to add a phone number to the public profile section. Of course, you can also add other information, but I figured to have a phone number on a profile would be a pretty important feature for advertisers.

    Before making any changes - back up your files!

    This mod was made using ClassiPress v3.2.1

    Step 1 - Create your icon
    You need to make a 16x16px .png icon to represent a phone.

    Save the file as "phone.png"

    Upload the icon to your theme's images folder:

    Code:
    http://www.yourdomain.com/wp-content/themes/classipress/images/phone.png
    Step 2 - Add a CSS rule for your icon

    Open your "style.css" file.

    Find this line: /* user profile icons */

    Add the following below that line:

    Code:
    .phoneico {
    	float:left;
    	height:16px;
    	width:16px;
    	padding-right:5px;
    	background:transparent url(images/phone.png) no-repeat scroll 0 0;
    }
    Save and upload style.css

    Step 3 - Modify theme-profile.php

    Open the file classipress/includes/theme-profile.php

    Find this at line 17:

    Code:
    function cp_user_contact_methods( $methods ) {
    	return array(
    		'twitter_id' => __( 'Twitter', APP_TD ),
    		'facebook_id' => __( 'Facebook', APP_TD ),
    		'paypal_email' => __( 'PayPal Email', APP_TD ),
    	);
    }
    add_action( 'user_contactmethods', 'cp_user_contact_methods' );
    Change to:

    Code:
    function cp_user_contact_methods( $methods ) {
    	return array(
    		'phone_number' => __( 'Phone Number', APP_TD ),	
    		'twitter_id' => __( 'Twitter', APP_TD ),
    		'facebook_id' => __( 'Facebook', APP_TD ),
    		'paypal_email' => __( 'PayPal Email', APP_TD ),
    	);
    }
    add_action( 'user_contactmethods', 'cp_user_contact_methods' );
    Now, find this at line 28:

    Code:
    function cp_profile_fields_description( $field ) {
    	$description = array(
    		'twitter_id' => __( 'Enter your Twitter username without the URL.', APP_TD ),
    		'facebook_id' => sprintf( __( "Enter your Facebook username without the URL. <br />Don't have one yet? <a target='_blank' href='%s'>Get a custom URL.</a>", APP_TD ), 'http://www.facebook.com/username/' ),
    		'paypal_email' => __( 'Used for purchasing ads via PayPal (if enabled).', APP_TD ),
    		
    	);
    	return isset($description[$field]) ? '<br /><span class="description">' . $description[$field] . '</span>' : '';
    }
    and change to:

    Code:
    function cp_profile_fields_description( $field ) {
    	$description = array(
    		'phone_number' => __( 'Your main contact number.', APP_TD ),
    		'twitter_id' => __( 'Enter your Twitter username without the URL.', APP_TD ),
    		'facebook_id' => sprintf( __( "Enter your Facebook username without the URL. <br />Don't have one yet? <a target='_blank' href='%s'>Get a custom URL.</a>", APP_TD ), 'http://www.facebook.com/username/' ),
    		'paypal_email' => __( 'Used for purchasing ads via PayPal (if enabled).', APP_TD ),
    		
    	);
    	return isset($description[$field]) ? '<br /><span class="description">' . $description[$field] . '</span>' : '';
    }
    Save and upload theme-profile.php

    Step 4 - modify author.php

    Open the file classipress/author.php

    At line 38 find this:

    Code:
    <ul class="author-info">
    									<li><strong><?php _e( 'Member Since:', APP_TD ); ?></strong> <?php echo date_i18n(get_option('date_format'), strtotime($curauth->user_registered)); ?></li>
    									<?php if ( !empty($curauth->user_url) ) { ?><li><strong><?php _e( 'Website:', APP_TD ); ?></strong> <a href="<?php echo esc_url($curauth->user_url); ?>"><?php echo strip_tags( $curauth->user_url ); ?></a></li><?php } ?>
    									<?php if ( !empty($curauth->twitter_id) ) { ?><li><div class="twitterico"></div><a href="http://twitter.com/<?php echo urlencode($curauth->twitter_id); ?>" target="_blank"><?php _e( 'Twitter', APP_TD ); ?></a></li><?php } ?>
    									<?php if ( !empty($curauth->facebook_id) ) { ?><li><div class="facebookico"></div><a href="http://facebook.com/<?php echo urlencode($curauth->facebook_id); ?>" target="_blank"><?php _e( 'Facebook', APP_TD ); ?></a></li><?php } ?>
    								</ul>
    Change to:

    Code:
    <ul class="author-info">
    									<li><strong><?php _e( 'Member Since:', APP_TD ); ?></strong> <?php echo date_i18n(get_option('date_format'), strtotime($curauth->user_registered)); ?></li>
    									<?php if ( !empty($curauth->user_url) ) { ?><li><strong><?php _e( 'Website:', APP_TD ); ?></strong> <a href="<?php echo esc_url($curauth->user_url); ?>"><?php echo strip_tags( $curauth->user_url ); ?></a></li><?php } ?>
    									<?php if ( !empty($curauth->phone_number) ) { ?><li><div class="phoneico"></div><?php echo esc_attr( $current_user->phone_number ); ?></li><?php } ?>
    									<?php if ( !empty($curauth->twitter_id) ) { ?><li><div class="twitterico"></div><a href="http://twitter.com/<?php echo urlencode($curauth->twitter_id); ?>" target="_blank"><?php _e( 'Twitter', APP_TD ); ?></a></li><?php } ?>
    									<?php if ( !empty($curauth->facebook_id) ) { ?><li><div class="facebookico"></div><a href="http://facebook.com/<?php echo urlencode($curauth->facebook_id); ?>" target="_blank"><?php _e( 'Facebook', APP_TD ); ?></a></li><?php } ?>
    								</ul>
    Save and upload author.php

    Step 5 - modify sidebar-user.php

    Open the file classipress/sidebar-user.php

    At line 65 find this:

    Code:
    <ul class="user-details">
    					<li><div class="emailico"></div><a href="mailto:<?php echo $current_user->user_email; ?>"><?php echo $current_user->user_email; ?></a></li>
    					<?php if ( !empty($current_user->twitter_id) ) { ?><li><div class="twitterico"></div><a href="http://twitter.com/<?php echo esc_attr( $current_user->twitter_id ); ?>" target="_blank"><?php _e( 'Twitter', APP_TD ); ?></a></li><?php } ?>
    					<?php if ( !empty($current_user->facebook_id) ) { ?><li><div class="facebookico"></div><a href="http://facebook.com/<?php echo esc_attr( $current_user->facebook_id ); ?>" target="_blank"><?php _e( 'Facebook', APP_TD ); ?></a></li><?php } ?>
    					<?php if ( !empty($current_user->user_url) ) { ?><li><div class="globeico"></div><a href="<?php echo esc_attr( $current_user->user_url ); ?>" target="_blank"><?php echo esc_html( $current_user->user_url ); ?></a></li><?php } ?>
    				</ul>
    Change to:

    Code:
    <ul class="user-details">
    					<li><div class="emailico"></div><a href="mailto:<?php echo $current_user->user_email; ?>"><?php echo $current_user->user_email; ?></a></li>
    					<?php if ( !empty($current_user->phone_number) ) { ?><li><div class="phoneico"></div><?php echo esc_attr( $current_user->phone_number ); ?></li><?php } ?>
    					<?php if ( !empty($current_user->twitter_id) ) { ?><li><div class="twitterico"></div><a href="http://twitter.com/<?php echo esc_attr( $current_user->twitter_id ); ?>" target="_blank"><?php _e( 'Twitter', APP_TD ); ?></a></li><?php } ?>
    					<?php if ( !empty($current_user->facebook_id) ) { ?><li><div class="facebookico"></div><a href="http://facebook.com/<?php echo esc_attr( $current_user->facebook_id ); ?>" target="_blank"><?php _e( 'Facebook', APP_TD ); ?></a></li><?php } ?>
    					<?php if ( !empty($current_user->user_url) ) { ?><li><div class="globeico"></div><a href="<?php echo esc_attr( $current_user->user_url ); ?>" target="_blank"><?php echo esc_html( $current_user->user_url ); ?></a></li><?php } ?>
    				</ul>
    Save and upload sidebar-user.php

    And that's it! I hope some of you find this mod useful.

    See examples attached below.
    Attached Images Attached Images

  2. The Following 2 Users Say Thank You to paulogoode For This Useful Post:

    mayed (January 27th, 2013), shoroh (August 20th, 2013)

  3. #2
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,236
    Thanks
    89
    Thanked 597 Times in 495 Posts

    Thumbs up Good Stuff!

    You must be an AppThemes customer and logged in to view this response. Join today!

  4. The Following User Says Thank You to dikiyforester For This Useful Post:

    paulogoode (December 19th, 2012)

  5. #3
    Thread Starter
    paulogoode's Avatar
    Join Date
    Oct 2012
    Location
    Ireland
    Posts
    37
    Thanks
    30
    Thanked 8 Times in 6 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  6. #4
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,236
    Thanks
    89
    Thanked 597 Times in 495 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  7. The Following User Says Thank You to dikiyforester For This Useful Post:

    paulogoode (December 19th, 2012)

  8. #5
    Thread Starter
    paulogoode's Avatar
    Join Date
    Oct 2012
    Location
    Ireland
    Posts
    37
    Thanks
    30
    Thanked 8 Times in 6 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  9. #6
    Thread Starter
    paulogoode's Avatar
    Join Date
    Oct 2012
    Location
    Ireland
    Posts
    37
    Thanks
    30
    Thanked 8 Times in 6 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  10. The Following 2 Users Say Thank You to paulogoode For This Useful Post:

    mayed (January 27th, 2013), shoroh (August 20th, 2013)

  11. #7
    Expired Customer hamdir's Avatar
    Join Date
    Jun 2016
    Posts
    36
    Thanks
    11
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  12. #8
    seoagent's Avatar
    Join Date
    Jul 2012
    Location
    Edmonton, AB, Canada
    Posts
    660
    Thanks
    136
    Thanked 86 Times in 74 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    When in doubt: Read, Ask, Do. G+

  13. #9
    Expired Customer arunart's Avatar
    Join Date
    Jan 2017
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  14. #10
    Member echo08's Avatar
    Join Date
    Nov 2011
    Location
    Philippines
    Posts
    68
    Thanks
    25
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!
    Please have a time to look @ my website. and leave a comment on how to make it better thanks
    My Website

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Phone number in Profile
    By pipno in forum ClassiPress General Discussion
    Replies: 34
    Last Post: March 19th, 2013, 02:51 AM
  2. Samcy Phone number field and location?
    By rtibbs4 in forum Help Using ClassiPress
    Replies: 7
    Last Post: January 9th, 2013, 12:57 PM
  3. [TUTORIAL] Adding Phone Number - My Way
    By scarstens in forum ClassiPress General Discussion
    Replies: 24
    Last Post: January 22nd, 2012, 01:31 PM
  4. Has anything gone wrong while adding phone number
    By abhijeet in forum Report ClassiPress Bugs
    Replies: 3
    Last Post: December 29th, 2011, 11:05 PM